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

I don't understand what I'm doing wrong..?

So..I have 2 scripts that I'm working on. The first one is for making my gui button function...here's what I have, which doesn't seem to work:

player = game.Players.PlayerAdded
button = script.Parent
function click()
	if click then
		game.StarterGui.FNMain.Frame.Play.Transparency = 1
		wait(.2)
		game.StarterGui.FNMain.Frame.Play.Transparency = 0
	end
end
button.MouseButton1Click:connect(click)


and then theres my 2nd script which I have been working very hard to get to work and it isn't...so I have a Gui Image that I want to go from 1 transparency to 0 transparency decreasing by .5. I have 3 scripts I attempted which won't work. Here are both:

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:wait()
local x=game.StarterGui.FNMain.Frame.ImageLabel
for i=1,10 do
wait(0.5)
x.ImageTransparency = x.ImageTransparency-0.1
end	
end)

Here's the 2nd script:

--[[x=game.StarterGui.FNMain.Frame.ImageLabel
for i=1,10 do
wait(0.5)
x.ImageTransparency = x.ImageTransparency-0.1
end]]
	

Here's the 3rd script:

local a = game.StarterGui.FNMain.Frame.ImageLabel 

for _ = 0, 1, .1 do
a.ImageTransparency = _
end

SORRY THAT THIS IS SO BIG..!

1 answer

All 3 ways would've worked if you properly defined your paths. This applies to every script that you've posted. If you just use game.StarterGui, that would change the GUI in StarterGui, NOT the Player's GUI. I would make all of the scripts local, and instead of game.StarterGui, put game.Players.LocalPlayer.PlayerGui. For the very first script, you didn't need to use the PlayerAdded event (Even though you didn't use it correctly).

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