100% found this document useful (1 vote)
2K views

Roblox FE Telekinesis Script

The document describes code for creating a telekinesis tool in Roblox. It instantiates various objects like a model, tool, part, scripts and assigns properties. It defines functions for connecting the tool to mouse clicks and key presses to pick up and manipulate objects in the environment by applying forces and changing properties.

Uploaded by

mama mia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
2K views

Roblox FE Telekinesis Script

The document describes code for creating a telekinesis tool in Roblox. It instantiates various objects like a model, tool, part, scripts and assigns properties. It defines functions for connecting the tool to mouse clicks and key presses to pick up and manipulate objects in the environment by applying forces and changing properties.

Uploaded by

mama mia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 6

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

You might also like