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

LocalPlayer a nil value?

button = script.Parent
target = game.Players.LocalPlayer.Character["CrimsonBlade"]
target2=game.Players.LocalPlayer.Character["Busternator"]
button.MouseButton1Click:connect(function()
	game.Players.LocalPlayer:LoadCharacter()
    target.Disabled=true
    target2.Disabled=false
end)

After clicking on the button the Dev console says: Players.Accelital.PlayerGui.ScreenGui.ScrollingFrame.CrimsonBlade.Script:4:attempt to index field 'LocalPlayer'(a nil value)

1 answer

✓ Accepted answer

LocalPlayer can only be accessed in a LocalScript.

2 comments

0

Local Scripts also don't work in workspace. This isn't much of a solution, but okay.

0

Yeah, after spending about 5 minutes struggling to word it correctly I gave up and just wrote this.

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