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

How do i show my screen GUI message?

Asked by 8 years ago

Im trying to make it to where when I step on buyPad1, it changes the transparency of the text to 0.

script.Parent.Touched:connect(function(buyMsg)
game.StarterGui.ScreenGui.Frame.purchaseText.TextTransparency = 0
end)

1 answer

Log in to vote
1
Answered by
lucas4114 607 Moderation Voter
8 years ago

You wouldn't use StarterGui for this, StarterGui is just the starter gui. When a player joins, the StarterGui is cloned into their PlayerGui. Also with this script you should make sure to check if what touched the part is a player.

script.Parent.Touched:connect(function(part) --'part' is what touched script.Parent
    if part.Parent:FindFirstChild("Humanoid") then --this checks if it is a character that touched it by checking for a "Humanoid" which is in all characters
        local player = game.Players:FindFirstChild(part.Parent.Name) --this would get the player using part.Parent.Name which would be the character's name
        if player then --this just checks if the player exists, because if your game has any npcs the character would exist but no player with its name
            player.PlayerGui.ScreenGui.Frame.purchaseText.TextTransparency = 0 --this would change "ScreenGui.Frame.purchaseText.TextTransparency" in the player to 0
        end
    end
end)
Ad

Answer this question