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

attempt to index global 'player' (a nil value) help?

Asked by 4 years ago

so i tried to make a tool but i got this error. 11:31:42.972 - Players.Abacus300.Backpack.Cash Giver.LocalScript:2: attempt to index global 'player' (a nil value) This is my code

local module = require(script.Parent:WaitForChild("ModuleScript") )local mouse = (player:GetMouse() )local player = game.Players.LocalPlayer() script.Parent.Activated:Connect(function() module.Lift() end)

Please Help me

1 answer

Log in to vote
0
Answered by 4 years ago

Next time please use the code block when posting code, and don't have it all jumbled up. Space it out, it'll help.

The problem (as you might imagine) is right here:

local player = game.Players.LocalPlayer()

.LocalPlayer() is not a function or anything where you would need the (), so just remove it.

Correct code:

local player = game.Players.LocalPlayer

Let me know if you have any questions

Ad

Answer this question