I have made this script, it is meant to spawn an object where you left clicked, then remove the tool. It spawns the object, but does not move it to where the mouse was clicked, and does not remove the tool after you click.
function onDown(mouse)
if mouse.Target ~= nil then
local object = game.Lighting:FindFirstChild("Raid"):clone()
object.Parent = game.Workspace
object:MoveTo(Vector3.new(mouse.Hit.p.x,(mouse.Hit.p.y + (mouse.Target.Size.y/2) + 3),mouse.Hit.p.z))
wait(0.00001)
script.Parent.Parent.Barrier:destroy()
end
end
function onSes(mouse)
mouse.Button1Down:connect(function() onDown(mouse) end)
end
script.Parent.Selected:connect(onSes)
Error:
16:38:31.289 - MoveTo is not a valid member of Part
16:38:31.291 - Script 'Players.Player.Backpack.Barrier.Script', Line 5 - global onDown
16:38:31.292 - Script 'Players.Player.Backpack.Barrier.Script', Line 12
16:38:31.293 - Stack End
It also does not work on online, any clue why? This has been frustrating me for hours, any help is appreciated
