-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtelekenisis.lua
More file actions
320 lines (320 loc) · 11.8 KB
/
telekenisis.lua
File metadata and controls
320 lines (320 loc) · 11.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
local function a(b, c)
local d = getfenv(c)
local e =
setmetatable(
{},
{__index = function(self, f)
if f == "script" then
return b
else
return d[f]
end
end}
)
setfenv(c, e)
return c
end
local g = {}
local h = Instance.new("Model", game:GetService("Lighting"))
local i = Instance.new("Tool")
local j = Instance.new("Part")
local k = Instance.new("Script")
local l = Instance.new("LocalScript")
local m = sethiddenproperty or set_hidden_property
i.Name = "Telekinesis"
i.Parent = h
i.Grip = CFrame.new(0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0)
i.GripForward = Vector3.new(-0, -1, -0)
i.GripRight = Vector3.new(0, 0, 1)
i.GripUp = Vector3.new(1, 0, 0)
j.Name = "Handle"
j.Parent = i
j.CFrame = CFrame.new(-17.2635937, 15.4915619, 46, 0, 1, 0, 1, 0, 0, 0, 0, -1)
j.Orientation = Vector3.new(0, 180, 90)
j.Position = Vector3.new(-17.2635937, 15.4915619, 46)
j.Rotation = Vector3.new(-180, 0, -90)
j.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
j.Transparency = 1
j.Size = Vector3.new(1, 1.20000005, 1)
j.BottomSurface = Enum.SurfaceType.Weld
j.BrickColor = BrickColor.new("Really black")
j.Material = Enum.Material.Metal
j.TopSurface = Enum.SurfaceType.Smooth
j.brickColor = BrickColor.new("Really black")
k.Name = "LineConnect"
k.Parent = i
table.insert(
g,
a(
k,
function()
wait()
local n = script.Part2
local o = script.Part1.Value
local p = script.Part2.Value
local q = script.Par.Value
local color = script.Color
local r = Instance.new("Part")
r.TopSurface = 0
r.BottomSurface = 0
r.Reflectance = .5
r.Name = "Laser"
r.Locked = true
r.CanCollide = false
r.Anchored = true
r.formFactor = 0
r.Size = Vector3.new(1, 1, 1)
local s = Instance.new("BlockMesh")
s.Parent = r
while true do
if n.Value == nil then
break
end
if o == nil or p == nil or q == nil then
break
end
if o.Parent == nil or p.Parent == nil then
break
end
if q.Parent == nil then
break
end
local t = CFrame.new(o.Position, p.Position)
local dist = (o.Position - p.Position).magnitude
r.Parent = q
r.BrickColor = color.Value.BrickColor
r.Reflectance = color.Value.Reflectance
r.Transparency = color.Value.Transparency
r.CFrame = CFrame.new(o.Position + t.lookVector * dist / 2)
r.CFrame = CFrame.new(r.Position, p.Position)
s.Scale = Vector3.new(.25, .25, dist)
wait()
end
r:remove()
script:remove()
end
)
)
k.Disabled = true
l.Name = "MainScript"
l.Parent = i
table.insert(
g,
a(
l,
function()
wait()
tool = script.Parent
lineconnect = tool.LineConnect
object = nil
mousedown = false
found = false
BP = Instance.new("BodyPosition")
BP.maxForce = Vector3.new(math.huge * math.huge, math.huge * math.huge, math.huge * math.huge)
BP.P = BP.P * 1.1
dist = nil
point = Instance.new("Part")
point.Locked = true
point.Anchored = true
point.formFactor = 0
point.Shape = 0
point.BrickColor = BrickColor.Black()
point.Size = Vector3.new(1, 1, 1)
point.CanCollide = false
local s = Instance.new("SpecialMesh")
s.MeshType = "Sphere"
s.Scale = Vector3.new(.7, .7, .7)
s.Parent = point
handle = tool.Handle
front = tool.Handle
color = tool.Handle
objval = nil
local u = false
local v = BP:clone()
v.maxForce = Vector3.new(30000, 30000, 30000)
function LineConnect(o, p, q)
local w = Instance.new("ObjectValue")
w.Value = o
w.Name = "Part1"
local x = Instance.new("ObjectValue")
x.Value = p
x.Name = "Part2"
local y = Instance.new("ObjectValue")
y.Value = q
y.Name = "Par"
local z = Instance.new("ObjectValue")
z.Value = color
z.Name = "Color"
local A = lineconnect:clone()
A.Disabled = false
w.Parent = A
x.Parent = A
y.Parent = A
z.Parent = A
A.Parent = workspace
if p == object then
objval = x
end
end
function onButton1Down(B)
if mousedown == true then
return
end
mousedown = true
coroutine.resume(
coroutine.create(
function()
local C = point:clone()
C.Parent = tool
LineConnect(front, C, workspace)
while mousedown == true do
C.Parent = tool
if object == nil then
if B.Target == nil then
local t = CFrame.new(front.Position, B.Hit.p)
C.CFrame = CFrame.new(front.Position + t.lookVector * 1000)
else
C.CFrame = CFrame.new(B.Hit.p)
end
else
LineConnect(front, object, workspace)
break
end
wait()
end
C:remove()
end
)
)
while mousedown == true do
if B.Target ~= nil then
local D = B.Target
if D.Anchored == false then
object = D
dist = (object.Position - front.Position).magnitude
break
end
end
wait()
end
while mousedown == true do
if object.Parent == nil then
break
end
local t = CFrame.new(front.Position, B.Hit.p)
BP.Parent = object
BP.position = front.Position + t.lookVector * dist
wait()
end
BP:remove()
object = nil
objval.Value = nil
end
function onKeyDown(E, B)
local E = E:lower()
local F = false
if E == "q" then
if dist >= 5 then
dist = dist - 10
end
end
if E == "r" then
if object == nil then
return
end
for G, H in pairs(object:children()) do
if H.className == "BodyGyro" then
return nil
end
end
BG = Instance.new("BodyGyro")
BG.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
BG.cframe = CFrame.new(object.CFrame.p)
BG.Parent = object
repeat
wait()
until object.CFrame == CFrame.new(object.CFrame.p)
BG.Parent = nil
if object == nil then
return
end
for G, H in pairs(object:children()) do
if H.className == "BodyGyro" then
H.Parent = nil
end
end
object.Velocity = Vector3.new(0, 0, 0)
object.RotVelocity = Vector3.new(0, 0, 0)
object.Orientation = Vector3.new(0, 0, 0)
end
if E == "e" then
dist = dist + 10
end
if E == "t" then
if dist ~= 10 then
dist = 10
end
end
if E == "y" then
if dist ~= 200 then
dist = 200
end
end
if E == "=" then
BP.P = BP.P * 1.5
end
if E == "-" then
BP.P = BP.P * 0.5
end
end
function onEquipped(B)
keymouse = B
local I = tool.Parent
human = I.Humanoid
human.Changed:connect(
function()
if human.Health == 0 then
mousedown = false
BP:remove()
point:remove()
tool:remove()
end
end
)
B.Button1Down:connect(
function()
onButton1Down(B)
end
)
B.Button1Up:connect(
function()
mousedown = false
end
)
B.KeyDown:connect(
function(E)
onKeyDown(E, B)
end
)
B.Icon = "rbxasset://textures\\GunCursor.png"
end
tool.Equipped:connect(onEquipped)
end
)
)
for J, H in pairs(h:GetChildren()) do
H.Parent = game:GetService("Players").LocalPlayer.Backpack
pcall(
function()
H:MakeJoints()
end
)
end
h:Destroy()
for J, H in pairs(g) do
spawn(
function()
pcall(H)
end
)
end