Lift people in the air like a telekinesis power

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to be able to lift people in the air like a telekinesis power
  2. What is the issue? Include screenshots / videos if possible!
    it work on parts but it dosen’t work on player and it dosen’t give me error
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    change script and rewrite
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

In a local script

BodyPosition    = Instance.new("BodyPosition")
			BodyPosition.MaxForce = Vector3.new(12000, 12000, 12000)
			BodyPosition.P        = BodyPosition.P
			BodyPosition.D        = 550

			local mouse = game.Players.LocalPlayer:GetMouse()

			local SetNetworkOwner = game.ReplicatedStorage.SetNetworkOwner

			local Character = game.Players.LocalPlayer.Character

			local RunService = game:GetService("RunService")
			
			InTelekinesis = true

			
			if mouse.Target ~= nil and mouse.Target.Locked == false then	
				if game.Players:GetPlayerFromCharacter(mouse.Target.Parent) then
					target = mouse.Target
					mouse.TargetFilter = target
					down = true
					PowerEvent:FireServer(action, inputState, target, Character.HumanoidRootPart, mouse.Hit, Character, down)
				else
					if mouse.Target:FindFirstChild("CanBeDragged") then
						target = mouse.Target
						mouse.TargetFilter = target
						SetNetworkOwner:FireServer(target)
						down = true 
					end
				end 
			end


			mouse.Move:Connect(function()
				if down == true and target ~= nil then 
					BodyPosition.Parent = target
					stepped = RunService.Heartbeat:Connect(function()
						BodyPosition.Position = Character.Head.Position + (mouse.Hit.Position - Character.Head.Position).Unit * 20
					end)
				end 
				if game.Players:GetPlayerFromCharacter(mouse.Target.Parent) then
					if InTelekinesis == true then
						print("Yo")
						RE.Telekinesis:FireServer(mouse.Target, Character, mouse)
					end
				end
           end) 

In a server script

local RE = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")

local TelekinesisEvent = RE.Telekinesis

local BodyPosition = Instance.new("BodyPosition")
local stepped

TelekinesisEvent.OnServerEvent:Connect(function(target, Character, mouse)
	BodyPosition.Parent = target.Parent:FindFirstChild("HumanoidRootPart")
	stepped = RunService.Heartbeat:Connect(function()
		BodyPosition.Position = Character.Head.Position + (mouse.Hit.Position - Character.Head.Position).Unit * 20
	end)
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like