Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Help with Gui script?

Script only works in studio mode.

local name = game.Players.LocalPlayer.Name
game.Workspace.Yeaa.Block.SurfaceGui.Frame.TextLabel.Text = name.. " is cool!"


if game.Workspace.Yeaa.Block.SurfaceGui.Frame.TextLabel.Text == name.. " is cool!" then
	wait(4)
	game.Workspace.Yeaa:Remove()
	
else
	game.Workspace.Yeaa.Block.SurfaceGui.Frame.TextLabel.Text = name.. " is cool!"
end

``

3 answers

✓ Accepted answer

From what I understand: First, game.Players.LocalPlayer can ONLY BE USED IN A LOCAL SCRIPT. a 'Local script' can only be used in StarterGui, StarterPlayer, or StarterPack( WITH THE EXCEPTION OF THE CHARACTER OF A PLAYER IN SOME INSTANCES.) What you COULD do is place the "Surface gui" with all the stuff, in PlayerGui. That would still work with the local script. All you would need to do is set the adorned as the Original part called 'Block' HOW YOU WOULD SET THE ADORNEE:

script.Parent.Adornee = game.Workspace.Yeaa.Block -- ( This would be in the local script located in the surface gui as the parent )

Full script:

script.Parent.Adornee = game.Workspace.Yeaa.Block
local name = game.Players.LocalPlayer.Name
script.Parent.Frame.TextLabel.Text = name .. " is cool!"
if script.Parent.Frame.TextLabel.Text == name.. " is cool!" then
    wait(4)
    game.Workspace.Yeaa:Remove()

else
    script.Parent.Frame.TextLabel.Text = name.. " is cool!"
end

If anything doesn't work, just comment and I'll walk you through it.

'game.Players.LocalPlayer' can only be used in LocalScripts...

4 comments

0

Thats not very helpful. Would you be able to change the script for me?

0

No, he's saying it can't be a REGULAR script. It has to be located in a LocalScript.

0

I put it in local script, it does not even work at all.

0

... That doesn't make sense what so ever.

Dude I need you to accept this. I need to join the chat again :( plz it helps

This discussion is preserved as it was. New answers, comments, and votes are closed.