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

Is there someway to make the MouseButton1Click event fire just one time ?

Asked by 2 years ago

i'm making a teleport room for my roblox game, i used a MouseButton1Click event that will add the player to the table, but something went wrong, i have just clicked the Gui once but the event fire a lot of times and insert a lot of thing to the table (my roblox username), how can i fix it ?

1 answer

Log in to vote
1
Answered by 2 years ago
Edited 2 years ago

this is what i can do, tell me if there is something wrong.


gui.MouseButton1Click:Connect(function(plr) if not plr:FindFirstChild("HasJoined") then local hasjoined = Instance.new("BoolValue", plr) hasjoined.Name = "hasjoined" if not plr:WaitForChild("HasJoined").Value == true then hasjoined.Value = true //put the rest of your script here end end end)
0
Sorry about my comment lol I was about to state you that not will not detect nil, but it looks like false and nil are labelled as non-true, your script is absolutely correct Xapelize 2658 — 2y
0
sorry im dumb at coding bc i have just joined study scripting for like some months but can you please explain it :D???? ninjaty2003 8 — 2y
1
well, thanks a lot for solving it for me but now i realize that we just need to use a local script instead and the error fixed, anyway, thanks for your answer 10000000 times ! ninjaty2003 8 — 2y
Ad

Answer this question