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

how to fix attempt to index local "Player" (a nil value) line 3?

Asked by 6 years ago

local Player = game.Players.LocalPlayer local player = game.Players:GetPlayerFromCharacter(char) local char = Player.Character local Character = Player.Character local RootPart = Character.HumanoidRootPart

1 answer

Log in to vote
0
Answered by 6 years ago
local Player = game.Players.LocalPlayer 
local player = game.Players:GetPlayerFromCharacter(char) 
local char = Player.Character
local Character = Player.Character 
local RootPart = Character.HumanoidRootPart

If you're trying to address game.Players.LocalPlayer, then you need to be using a LocalScript

Ad

Answer this question