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

TextLabel isn't a valid member of ScreenGui?

Asked by 4 years ago
Edited 4 years ago

When I tried to run a code that makes a little window pop up when you equip an item, the output said: "TextLabel is not a valid member of ScreenGui". I am confused.

local sword = game.Workspace.ClassicSword

sword.Equipped:Connect(function(eqp)
    script.Parent.ScreenGui.TextLabel.BackgroundTransparency = 0
    script.Parent.ScreenGui.TextLabel.TextTransparency = 0
    script.Parent.ScreenGui.TextLabel.Text = "This is incredible!"
    script.Parent.Ding:Play()
    wait(6)
    script.Parent.ScreenGui.TextLabel.Text = "It seems you have found an artifact from this planet."
    script.Parent.Ding:Play()
    wait(6)
    script.Parent.ScreenGui.TextLabel.Text = "It is an ancient sword."
    script.Parent.Ding:Play()
    wait(6)
    script.Parent.ScreenGui.TextLabel.Text = "The sword may be useful later on."
    script.Parent.Ding:Play()
    wait(6)
    script.Parent.ScreenGui.TextLabel.BackgroundTransparency = 1
    script.Parent.ScreenGui.TextLabel.TextTransparency = 1
end)
0
Hold on buddy, one question: "Where is this script located?" Is there an instance called ScreenGui inside script.Parent or is script.Parent the ScreenGui? YTRaulByte 389 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Is TextLabel an Object located in ScreenGui or are you trying to change the text of something? If so, make sure it's on the TextLabel (or whatever) then do .TextLabel.

Ad

Answer this question