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

Player value not working in game ?

Asked by 7 years ago
local Tool = script.Parent
local Player = Tool.Parent.Parent
local Handle = Tool.Handle
local Player = game.Players.LocalPlayer
local Character = Player.Character
local sound = Instance.new("Sound")
sound.SoundId = "http://www.roblox.com/asset/?id=165969964"
sound.Parent = script.Parent


Tool.Activated:connect(function(plr)
    sound:play()
    Character.Humanoid.Health = 0
    wait()
end)

it tell me that I attempted to index global "Player" (a nil value)

any fix ?

0
You referenced Player two times as a Character and a Player object. mightydifferent 85 — 7y
0
If this is a server script, then LocalPlayer is nil. cabbler 1942 — 7y

Answer this question