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

Help me, my GUI opener script doesn't work?

Asked by
lucas4114 607 Moderation Voter
9 years ago

Ok, I am making a game, and have a GUI thats ment to open when a player walks on a part, and GUIopen is a bool value in the script.Parent.Value and it does get closed, in the GUI thats ment to open there a "Close" button that closes everything that was open and makes the GUIopen false.


debounce = false GUIopen = script.Parent.Value function onTouched(hit) local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr and debounce == false then if GUIopen.Value == false then debounce = true GUIopen.Value = true wait(0.1) plr:WaitForChild("PlayerGui").TeleportMenu.Background.Visible = true plr:WaitForChild("PlayerGui").TeleportMenu.Background.Transparency = 1 wait(0.1) plr:WaitForChild("PlayerGui").TeleportMenu.Background.Transparency = 0.9 wait(0.1) plr:WaitForChild("PlayerGui").TeleportMenu.Background.Transparency = 0.8 wait(0.1) plr:WaitForChild("PlayerGui").TeleportMenu.Background.Transparency = 0.7 wait(0.1) plr:WaitForChild("PlayerGui").TeleportMenu.Background.Transparency = 0.6 wait(0.1) plr:WaitForChild("PlayerGui").TeleportMenu.Background.Transparency = 0.5 wait(0.1) plr:WaitForChild("PlayerGui").TeleportMenu.Background.Transparency = 0.4 wait(0.1) plr:WaitForChild("PlayerGui").TeleportMenu.Background.Transparency = 0.3 wait(0.1) plr:WaitForChild("PlayerGui").TeleportMenu.Background.Transparency = 0.2 wait(0.1) plr:WaitForChild("PlayerGui").TeleportMenu.Background.Transparency = 0.1 wait(0.05) plr:WaitForChild("PlayerGui").TeleportMenu.Frame.Visible = true wait(0.04) plr:WaitForChild("PlayerGui").TeleportMenu.Frame.Title.Visible = true wait(0.04) plr:WaitForChild("PlayerGui").TeleportMenu.Frame.MultiPlayerButton.Visible = true wait(0.04) plr:WaitForChild("PlayerGui").TeleportMenu.Frame.SinglePlayerButton.Visible = true wait(0.04) plr:WaitForChild("PlayerGui").TeleportMenu.Frame.BossPlayerButton.Visible = true wait(0.05) plr:WaitForChild("PlayerGui").TeleportMenu.Frame.BackButton.Visible = true debounce = false end end end script.Parent.Touched:connect(onTouched)

So, the script works when I test it alone in studio, but when I got someone else to test in in-game in the roblox player heres what happens, It works for me when I step on it for the first time then it worked, the I got off, then the other player tried to step on it and it didn't work, and I tried again after him and it didn't work for me too.... Then, we both left, and we joined again, and I told the player to step on the part first this time, and he said it worked, so then he got off, and I tried then it didn't work for me, then he tried getting on it again and it didn't work... D: This is too messed up for me, please help?

1 answer

Log in to vote
0
Answered by 9 years ago

Is this a server side script? If so you should be using a remote function/event so that all of the animation is done by the client and not the server as this will cause a lot of lag.

This script will not run again because of this line:-

GUIopen.Value = true

This will stop the script from running the next time as this will be true.

Hope this helps.

0
But the value goes back to being false after the player closes the GUI that opened....? lucas4114 607 — 9y
0
And the GUIopen needs to be there anyway, because without it the script opens the GUI way to many times when the player walks on the part... lucas4114 607 — 9y
0
The debounce is supposed to stop the oveflow, try removing GUIopen.Value = true to test if works without it User#5423 17 — 9y
0
Have you tried making a for loop? You don't need to copy and paste a ton of code. Monsieur_Robert 338 — 9y
0
Heh, thats my way of doing things... :P lucas4114 607 — 9y
Ad

Answer this question