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

Help with Gui script?

Asked by
FiredDusk 1466 Moderation Voter
8 years ago

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

Log in to vote
0
Answered by 8 years ago

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.

Ad
Log in to vote
0
Answered by 8 years ago

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

0
Thats not very helpful. Would you be able to change the script for me? FiredDusk 1466 — 8y
0
No, he's saying it can't be a REGULAR script. It has to be located in a LocalScript. deputychicken 226 — 8y
0
I put it in local script, it does not even work at all. FiredDusk 1466 — 8y
0
... That doesn't make sense what so ever. deputychicken 226 — 8y
Log in to vote
0
Answered by 8 years ago

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

Answer this question