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

Why my gui won't change his transparency?

Asked by 6 years ago
Edited 6 years ago
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

Log in to vote
2
Answered by
amanda 1059 Moderation Voter
6 years ago

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)
0
Ooh! Thank you for helping the noob!(me) MEndermanM 73 — 6y
Ad

Answer this question