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

Help on my GUI property change script?

Asked by
Mystdar 352 Moderation Voter
10 years ago

I have a local script with parents like (in the player): this The Sword value is located here, in a model, in the player

The script is supposed to make it's parented frame invisible, should they players sword value be above 0 But if it is 0 then it is 0.2 opaque, (Almost opaque)

local player = game.Players.LocalPlayer --The local player.
local sword = player.Folder:WaitForChild("PWSword")
local frame = script.Parent
if sword.Value>0 then
    frame.Transparency = 1
else frame.Transparency = 0.2
end
sword.Changed:connect(function() --Connects a function to an event. Known as an anonymous function (as it has no direct identifier.)
        if sword.Value>0 then
        frame.Transparency = 1
        else frame.Transparency = 0.2
        end 
    end) --Ends the anonymous function.

As a reminder you can see the Output in the screenshots. Thanks.

Answer this question