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

[HELP!] attempt to index field 'LocalPlayer' (a nil value)?

Asked by 8 years ago
function onClick()
            game.Lighting["Card"]:Clone().Parent = game.Players.LocalPlayer.StarterGear
            game.Lighting["Card"]:Clone().Parent = game.Players.LocalPlayer.Backpack
    end
script.Parent.MouseButton1Click:connect(onClick)

It is a SurfaceGui TextButton script.

0
LocalPlayer can ONLY be used in a LocalScript. M39a9am3R 3210 — 8y
0
I put it in LocalScript, but it won't work. Scertan 0 — 8y
1
LocalScripts will only work in a player's character, backpack, playergui, or playerscripts. You would need to modify your code to find the SurfaceGui. M39a9am3R 3210 — 8y

Answer this question