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

TextLabel is not a valid member of Workspace?

Asked by 7 years ago

Hello Helpers so it says in the output TextLabel is not a valid member of Workspace and I put

Log = script.Parent
Tree = game.Workspace.Tree

script.Parent.mouseClick:connect(function()
Instance.new ("ScreenGui", game.StarterGui)
Instance.new ("TextLabel", game.StarterGui)
    game.Workspace.TextLabel.Text = ("Timber")

    wait(0.032)

end)

please help me i am a middle scripting

0
You do realize you're parenting the TextLabel to StarterGui and not Workspace right? Meltdown81 309 — 7y

2 answers

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

Obvisouly you are new to Lua. Welcome to scripting helpers. Firstly, if you are making the screen GUI inside StarterGui, why find it in workspace?

Log = script.Parent
Tree = game.Workspace.Tree

Log.ClickDetector.MouseClick:connect(function()
    scr = Instance.new ("ScreenGui", game.StarterGui)
    txt = Instance.new ("TextLabel",scr) -- Textlabel goes inside the ScreenGui so you can see it
    txt.Text = ("Timber") -- Update the text.
    wait(0.032)
end)

Secondly if you do that, you are changing the StarterGui not the PlayerGui so it won't update for the player.

Log = script.Parent
Tree = game.Workspace.Tree

Log.ClickDetector.MouseClick:connect(function()
    local scr = Instance.new ("ScreenGui", game.Players.LocalPlayer.PlayerGui)
    local txt = Instance.new ("TextLabel",scr) -- Textlabel goes inside the ScreenGui so you can see it
    txt.Text = ("Timber") -- Update the text.
    txt.Size = UDim2.new(0,100,0,100) -- Size of the text label.
    txt.Position= UDim2.new(0.5,0,0.5,0) -- Position of the text label.
    wait(0.032)
end)

Finally, we need to make the gui destroy itself after a time.

Log = script.Parent
Tree = game.Workspace.Tree

Log.ClickDetector.MouseClick:connect(function()
    local scr = Instance.new ("ScreenGui", game.Players.LocalPlayer.PlayerGui)
    local txt = Instance.new ("TextLabel",scr) -- Textlabel goes inside the ScreenGui so you can see it
    txt.Text = ("Timber") -- Update the text.
    txt.Size = UDim2.new(0,100,0,100) -- Size of the text label.
    txt.Position= UDim2.new(0.5,0,0.5,0) -- Position of the text label.
    wait(3)
    scr:Destroy() -- Destroy the screengui!
end)

Firstly, make sure that the script's parent (inside) the log. Also make sure there is a click detector inside the log. Then make sure the script is a local script. You are done!

Ad
Log in to vote
0
Answered by 7 years ago

The way your coding is set up gives me the impression that your new to scripting so go watch a few tutorials. Is the scripts parent a ClickDetector otherwise this event won't work.

Log = script.Parent
Tree = game.Workspace.Tree

script.Parent.MouseClick:connect(function()
scr = Instance.new ("ScreenGui", game.StarterGui)
txt = Instance.new ("TextLabel",scr)
txt.Text = ("Timber")
wait(0.032)
end)
0
i watch 14 videos of whitetoxicwaster and all of those are scripting vidoes Gamerboy8643 -11 — 7y
0
also whats the Scr and Txt Gamerboy8643 -11 — 7y
0
They are variables he has defined. TheUniPiggy 77 — 7y

Answer this question