Workspace.Handle.Script:14: attempt to index local 'player' (a nil value)..? [closed]
function getPlayer(humanoid)
local players = game.Players:children()
for i = 1, #players do
if players[i].Character.Humanoid == humanoid then return players[i] end
end
return nil
end
function onTouch(part)
local human = part.Parent:findFirstChild("Humanoid")
local player = getPlayer(human)
local Backpack = player:WaitForChild("Backpack")
local Character = workspace:WaitForChild(player.Name)
local item = Backpack:FindFirstChild("Jet Pack")
local item1 = Character:FindFirstChild("Jet Pack")
if item == nil and item1 == nil then
game.ServerStorage:FindFirstChild("Jet Pack"):clone().Parent = player.Backpack
end
end
script.Parent.Touched:connect(onTouch)
Closed as Not Constructive by User#24403
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?