Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Made this script at 5am, isn't working?

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.

1 comment

0

Actually seems to be working now, just needed it to be a localscript in the tool.

1 answer

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.

5 comments

0

Thought so. That may fix it with the button1down, but how can I make the tool.Activated version work? Else the tool doesn't have to be selected.

0

Also, though it might work, considering if you've selected the tool before the local player part fires, it will get it wrong. Is there a way to wait for a character to load?

0

urgh, I give up. The physics engine is also messing me up now, with my characters zooming off in diagonal directions yet physically stopping when going straight.

0

Is this a HopperBin, or a Tool?

0

tool.

This discussion is preserved as it was. New answers, comments, and votes are closed.