Hello Helpers so it says in the output TextLabel is not a valid member of Workspace and I put
01 | Log = script.Parent |
02 | Tree = game.Workspace.Tree |
03 |
04 | script.Parent.mouseClick:connect( function () |
05 | Instance.new ( "ScreenGui" , game.StarterGui) |
06 | Instance.new ( "TextLabel" , game.StarterGui) |
07 | game.Workspace.TextLabel.Text = ( "Timber" ) |
08 |
09 | wait( 0.032 ) |
10 |
11 | end ) |
please help me i am a middle scripting
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?
1 | Log = script.Parent |
2 | Tree = game.Workspace.Tree |
3 |
4 | Log.ClickDetector.MouseClick:connect( function () |
5 | scr = Instance.new ( "ScreenGui" , game.StarterGui) |
6 | txt = Instance.new ( "TextLabel" ,scr) -- Textlabel goes inside the ScreenGui so you can see it |
7 | txt.Text = ( "Timber" ) -- Update the text. |
8 | wait( 0.032 ) |
9 | end ) |
Secondly if you do that, you are changing the StarterGui not the PlayerGui so it won't update for the player.
01 | Log = script.Parent |
02 | Tree = game.Workspace.Tree |
03 |
04 | Log.ClickDetector.MouseClick:connect( function () |
05 | local scr = Instance.new ( "ScreenGui" , game.Players.LocalPlayer.PlayerGui) |
06 | local txt = Instance.new ( "TextLabel" ,scr) -- Textlabel goes inside the ScreenGui so you can see it |
07 | txt.Text = ( "Timber" ) -- Update the text. |
08 | txt.Size = UDim 2. new( 0 , 100 , 0 , 100 ) -- Size of the text label. |
09 | txt.Position = UDim 2. new( 0.5 , 0 , 0.5 , 0 ) -- Position of the text label. |
10 | wait( 0.032 ) |
11 | end ) |
Finally, we need to make the gui destroy itself after a time.
01 | Log = script.Parent |
02 | Tree = game.Workspace.Tree |
03 |
04 | Log.ClickDetector.MouseClick:connect( function () |
05 | local scr = Instance.new ( "ScreenGui" , game.Players.LocalPlayer.PlayerGui) |
06 | local txt = Instance.new ( "TextLabel" ,scr) -- Textlabel goes inside the ScreenGui so you can see it |
07 | txt.Text = ( "Timber" ) -- Update the text. |
08 | txt.Size = UDim 2. new( 0 , 100 , 0 , 100 ) -- Size of the text label. |
09 | txt.Position = UDim 2. new( 0.5 , 0 , 0.5 , 0 ) -- Position of the text label. |
10 | wait( 3 ) |
11 | scr:Destroy() -- Destroy the screengui! |
12 | 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!
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.
1 | Log = script.Parent |
2 | Tree = game.Workspace.Tree |
3 |
4 | script.Parent.MouseClick:connect( function () |
5 | scr = Instance.new ( "ScreenGui" , game.StarterGui) |
6 | txt = Instance.new ( "TextLabel" ,scr) |
7 | txt.Text = ( "Timber" ) |
8 | wait( 0.032 ) |
9 | end ) |