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

(a nil value) i need help to fix a plr value?

Workspace.H1C1.BLUE.SurfaceGui.TextButton.Script:4: attempt to index upvalue 'plr' (a nil value)

I need help to fix this, its says a nil value when i put local plr = game.Players.LocalPlayer

2 comments

0

r

0

BOII

1 answer

Note that you can only use game.Players.LocalPlayer in a LocalScript. You are using a normal script so that is why it won't work :)

http://wiki.roblox.com/index.php?title=API:Class/Players/LocalPlayer

If you have a event that listens to a click on the textbutton, you will need to do the following:

script.Parent.MouseButton1Click:connect(function(player)
	--code
end)

The 'player' will become the player who clicked it as that is a standard value that gets sent throug h at the event MouseButton1Click.

http://wiki.roblox.com/index.php?title=API:Class/GuiButton/MouseButton1Click

2 comments

0

Yeah, iDevity should have read my bio.

0

:Connect()

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