GameBuilderLol
GameBuilderLol

Reputation: 39

Part moving towards screen?

The part is supposed to move to the mouse's position and it worked almost fine but the thing is it moves towards my screen...

Local script:

local moveevent = script:WaitForChild("MoveEvent")

script.Parent.Parent.Equipped:Connect(function(mouse)
mouse.Move:Connect(function()
    moveevent:FireServer(mouse.Hit.p)
end)
end)

Script:

local moveevent = script.Parent:WaitForChild("MoveEvent")


moveevent.OnServerEvent:Connect(function(plr, mousepos)
    workspace:WaitForChild("Spawnpart").Position = mousepos
end)

Upvotes: 0

Views: 103

Answers (1)

kojocrash
kojocrash

Reputation: 341

In local script:

mouse.TargetFilter = workspace:WaitForChild("Spawnpart")

What's happening is that your mouse it hitting the part instead of what's behind it. Read more

Upvotes: 1

Related Questions