When I use Mouse.Hit.p the part that was created keeps moving towards my camera?
local player = game.Players.LocalPlayer local mouse = player:GetMouse() mouse.KeyDown:connect(function(key) if key == "1" then --//Magnet Release\\-- if script.Parent.Jutsu.Value == "SandManipulation" then local MoveableSand = game.ReplicatedStorage.Test:Clone() MoveableSand.Parent = game.Workspace wait(0.1) mouse.Button1Down:connect(function() for i = 1, 1000 do wait(0.01) MoveableSand.Position = mouse.Hit.p end end) end
Please help?
Try this version of the script. Just changed 2 lines that i noted.
local player = game.Players.LocalPlayer local mouse = player:GetMouse() mouse.KeyDown:connect(function(key) if key == "1" then --//Magnet Release\\-- if script.Parent.Jutsu.Value == "SandManipulation" then local MoveableSand = game.ReplicatedStorage.Test:Clone() MoveableSand.Parent = game.Workspace wait(0.1) mouse.Button1Down:connect(function() for i = 1, 1000 do wait(0.01) if mouse.Hit.Name ~= "MODELNAMEHERE" then --Add this MoveableSand.Position = mouse.Hit.p end -- And this end end) end