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

Urgent HELP! Why it don't work?

So guys i have a ScreenGui.TextButton and it seems to don't work i do that thing .. WHY? "StarterGui.textButton.MouseButton1Down:connect(function() print(("I try i try")) game.StarterGui.textButton.BackgroundTransparency = 0 wait(0.2) game.StarterGui.textButton.BackgroundTransparency = 0.1 wait(0.2) game.StarterGui.textButton.BackgroundTransparency = 0.2 wait(0.2) game.StarterGui.textButton.BackgroundTransparency = 0.3 wait(0.2) game.StarterGui.textButton.BackgroundTransparency = 0.4 wait(0.2) game.StarterGui.textButton.BackgroundTransparency = 0.5 wait(0.2) game.StarterGui.textButton.BackgroundTransparency = 0.6 wait(0.2) game.StarterGui.textButton.BackgroundTransparency = 0.7 wait(0.2) game.StarterGui.textButton.BackgroundTransparency = 0.8 wait(0.2) game.StarterGui.textButton.BackgroundTransparency = 0.9 wait(0.2) game.StarterGui.textButton.BackgroundTransparency = 1 wait(0.2) game.StarterGui.textButton.TextTransparency = 0 wait(0.2) game.StarterGui.StarterGui.textButton.TextTransparency = 0.1 wait(0.2) game.StarterGui.textButton.TextTransparency = 0.2 wait(0.2) game.StarterGui.textButton.TextTransparency = 0.3 wait(0.2) game.StarterGui.textButton.TextTransparency = 0.4 wait(0.2) game.StarterGui.textButton.TextTransparency = 0.5 wait(0.2) game.StarterGui.textButton.TextTransparency = 0.6 wait(0.2) game.StarterGui.textButton.TextTransparency = 0.7 wait(0.2) game.StarterGui.textButton.TextTransparency = 0.8 wait(0.2) game.StarterGui.textButton.TextTransparency = 0.9 wait(0.2) game.StarterGui.textButton.TextTransparency = 1 wait(0.3)

end)" But it dosn't work help ?

3 answers

Startergui is given when a player spawns, so It should be game.Players.PLAYERNAME.PlayerGui

Firstly, as pointed out by fai1bro you need to change the GUI that's in the player's PlayerGui, not the one which is in the StarterGui service.

Secondly, how you're changing the transparency of the button is incredibly long winded, decreases readability and is a waste of time. You can achieve the same effect by use of a for loop.


Below is my suggestion of how this code could be improved by the use of a for loop. For it to work it would need to be placed inside of the TextButton.

script.Parent.MouseButton1Down:connect(function()
	for Transparency = 0, 1, 0.1 do
		wait(0.2)
		script.Parent.BackgroundTransparency = Transparency
		script.Parent.TextTransparency = Transparency
	end
end)

You need to capitalize "textButton." Scripts are case-sensitive.

5 comments

0

Still don't work :{

0

There's one line of your code where "StarterGui" is repeated, so you'll have to delete one copy.

0

Do you got skype so you can show me where? I don't see it facepalm.

0

No, sorry.

0

Accept party on ROBLOX so we can talk then ?

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