Heyo, I recently tried to make a script where, upon clicking with a tool, set a flag which little robots would move too. It was at 5am, and I was, and still am, very tired. I'd appreciate help finding what's wrong with it.
`local Player = script.Parent.Parent.Parent local Mouse = Player:GetMouse() local Tool = script.Parent
function click() game.Workspace.Flag.Position = Mouse.Hit.p
end
Tool.Activated:connect(click)
`
If you replace the connect with Mouse.Button1Down:connect(click), it works in studio mode but not in-game regularly, as well. Can't find the mouse it seems.
In studio, the player is loaded before the script is executed. Vise versa in a roblox game server. Try adding a wait of 3 or 4 seconds.