Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 9 years ago

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.

0
Actually seems to be working now, just needed it to be a localscript in the tool. Maxwell_Edison 105 — 9y

1 answer

Log in to vote
0
Answered by
Mr_Octree 101
9 years ago

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.

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. Maxwell_Edison 105 — 9y
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? Maxwell_Edison 105 — 9y
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. Maxwell_Edison 105 — 9y
0
Is this a HopperBin, or a Tool? Mr_Octree 101 — 9y
0
tool. Maxwell_Edison 105 — 9y
Ad

Answer this question