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

Variable not working? [SOLVED]

Asked by 10 years ago

I'm getting an error that says: Workspace.Camera.screenPiece.back.shop stuff.money.Script:3: attempt to index local 'player' (a nil value)

local char = script.Parent.Parent.Parent.Parent.Parent
local player = game.Players:GetPlayerFromCharacter(char)
local resources = player.resources

while wait() do
    if player then
    script.Parent.Text = tostring(resources.Value)
    end
end

Answer this question