So recently I’v been trying to make a telekinesis ability where you can drag objects around I followed an article and read through it This one but apparently it doesn’t quite work and the part just teleports somewhere infront of you I feel like i messed up somewhere or im missing something but I really don’t know any help would mean so much
Here is my script:
-- !strict
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()
local Mouse = Player:GetMouse()
local UserInputService = game:GetService("UserInputService")
local Hrp = Char:WaitForChild("HumanoidRootPart")
local Rs = game:GetService("RunService")
local Camera = game.Workspace.CurrentCamera
Mouse.Button1Up:Connect(function(input, IsTyping)
local MouseTarget = Mouse.Target
if not MouseTarget then return end
if MouseTarget ~= nil then
Mouse.TargetFilter = MouseTarget
local location = Camera.CFrame.Position + (Mouse.Hit.Position - Camera.CFrame.Position).Unit * 20
Mouse.Move:Connect(function()
MouseTarget.Position = location
end)
end
end)