Hi i want make like a telekinesis power and i want be abe to drag and control other player ine the air i have already a script but i don’t know why it’s dosen’t work also i’m not a advanced scripter then i’m maybe gonna ask question to you if i don’t understand anything
Anyway, here is my script
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local uis = game:GetService("UserInputService")
local camera = workspace.CurrentCamera
local teleEnabled = false
local targetedModel = nil
local maxRange = 25
mouse.Button1Down:Connect(function()
local target = mouse.Target
if target and target.Parent:FindFirstChild("Humanoid") then
teleEnabled = true
targetedModel = target.Parent.PrimaryPart
local bp = Instance.new("BodyPosition", targetedModel)
bp.MaxForce = Vector3.new(5e5,5e5,5e5)
bp.Position = player.Character.HumanoidRootPart.Position
end
end)
mouse.Button1Up:Connect(function()
teleEnabled = false
if targetedModel and targetedModel:FindFirstChild("BodyPosition") then
targetedModel.BodyPosition:Destroy()
end
targetedModel = nil
end)
mouse.Move:Connect(function()
if teleEnabled == true then
if targetedModel then
local location = camera.CFrame.Position + (mouse.Hit.Position - camera.CFrame.Position).Unit * maxRange
targetedModel.BodyPosition.Position = location
end
end
end)
It’s work on dummy but it’s dosen’t work with player and it dosen’t give me any error in the output