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

ImageTransparency changes in properties but not on screen?

Asked by 6 years ago

I have a script where every time you click on a brick, the Image on screen will change transparency, it will show that the transparency changes in properties but not on screen. I have Script in click detector in part, and I have ImageLabel in a ScreenGui under StarterGui. Script:

local CD = script.Parent
game.StarterGui.ScreenGui.ImageLabel.ImageTransparency = 1

CD.MouseClick:connect(function(click)
    game.StarterGui.ScreenGui.ImageLabel.ImageTransparency = game.StarterGui.ScreenGui.ImageLabel.ImageTransparency - 1
end)
 -- more than one variables gets me confused sometimes

1 answer

Log in to vote
0
Answered by
Nikkulaos 229 Moderation Voter
6 years ago

This is happening because your changing the transparency of the frame through the "StarterGui".

The StarterGui and PlayerGui are 2 different things. StarterGui is the gui the player starts with, so they will only see its changes when they respawn. PlayerGui is the gui the player see's ingame.

It would instead be this:

local CD = script.Parent
game.Players.LocalPlayer.PlayerGui.ScreenGui.ImageLabel.ImageTransparency = 1

CD.MouseClick:connect(function(click)
    game.Players.LocalPlayer.PlayerGui.ScreenGui.ImageLabel.ImageTransparency = game.Players.LocalPlayer.PlayerGui.ScreenGui.ImageLabel.ImageTransparency - 1
end)
Ad

Answer this question