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

Why my gui won't change his transparency?

local Player = game:GetService('Players').LocalPlayer
local FakeCharacter = Player.Character or Player.CharacterAdded:Wait()
local Character = FakeCharacter:WaitForChild("Humanoid")
local Text = game.StarterGui.ScreenGui.WaitingForMorePlayers.TextStrokeTransparency
local TextBody = game.StarterGui.ScreenGui.WaitingForMorePlayers.TextTransparency

Character.WaitForMorePlayers.Changed:connect(function(NewValue)
	if NewValue == true then
		Text = 0 --I changed my value actually, but still not work.
		TextBody = 0
	end
end)

I hope it said it all.
By the way, i checked him too, he was working(i use debug tool then it says working.).
Thanks for answer!!

1 answer

✓ Accepted answer

The reason this is not working, is because variables cannot hold references to properties, only their values.

So what you should do, is use variables to store references to the objects.

Additionally, you are attempting to change the property of a gui in the StarterGui folder, when you should be accessing the player's PlayerGui and aside from that the same path.

Analyze the code below, and ask any questions, as this is the same for all objects and all properties.

local Player = game:GetService('Players').LocalPlayer
local FakeCharacter = Player.Character or Player.CharacterAdded:Wait()
local Character = FakeCharacter:WaitForChild("Humanoid")
local Text = Player.PlayerGui.ScreenGui.WaitingForMorePlayers

Character.WaitForMorePlayers.Changed:connect(function(NewValue)
    if NewValue == true then
        Text.TextStrokeTransparency = 0
        Text.TextTransparency = 0
    end
end)

1 comment

0

Ooh! Thank you for helping the noob!(me)

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