Apologies if this is a stupid question, I'm new to Lua coding, however when I touch my brick, the background transparency VALUE changes as it should, however the GUI does not appear, despite when looking at the value in testing being gradually changed to 0. Apologies also if the code is a bit messy.
function onTouched(player) --Enables when brick is touched. local parent = player.Parent local stageGui = game.StarterGui.Stage if game.Players:GetPlayerFromCharacter(parent) then --Makes sure a player touched it. if game.Players[player.Parent.Name].leaderstats.Stage.Value == 0 then --Checks if Stage (leaderstat value) is 0. stageGui.Welcome.BackgroundTransparency = 0.9 --Gradually Changes the Transparency of the GUI. wait(0.1) stageGui.Welcome.BackgroundTransparency = 0.7 wait(0.1) stageGui.Welcome.BackgroundTransparency = 0.5 wait(0.1) stageGui.Welcome.BackgroundTransparency = 0.3 wait(0.1) stageGui.Welcome.BackgroundTransparency = 0 wait(4) stageGui.Welcome.BackgroundTransparency = 1 --After 4 seconds make the GUI invisible. end end end script.Parent.Touched:connect(onTouched)
Nothing appears in the output.
Turns out it was because I was calling on the GUI stored in StarterGui, instead of the one stored in the player. Just going to post this here as it worked!
function onTouched(player) --Enables when brick is touched. local parent = player.Parent local stageGui = game.Players[player.Parent.Name].PlayerGui.Stage --Calls on the PLAYERS Gui. if game.Players:GetPlayerFromCharacter(parent) then --Checks a player touched it. if game.Players[player.Parent.Name].leaderstats.Stage.Value == 0 then --Checks if Stage is 0. stageGui.Welcome.BackgroundTransparency = 0.9 --Gradually makes GUI visible. wait(0.1) stageGui.Welcome.BackgroundTransparency = 0.8 wait(0.1) stageGui.Welcome.BackgroundTransparency = 0.7 wait(0.1) stageGui.Welcome.BackgroundTransparency = 0.6 wait(0.1) stageGui.Welcome.BackgroundTransparency = 0.5 wait(0.1) stageGui.Welcome.BackgroundTransparency = 0.4 wait(0.1) stageGui.Welcome.BackgroundTransparency = 0.3 wait(0.1) stageGui.Welcome.BackgroundTransparency = 0.2 wait(0.1) stageGui.Welcome.BackgroundTransparency = 0.1 wait(0.1) stageGui.Welcome.BackgroundTransparency = 0 wait(4) --After 4 seconds makes GUI invisible. stageGui.Welcome.BackgroundTransparency = 1 end end end script.Parent.Touched:connect(onTouched)