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)
COMMUNITY QUESTION
Workspace.Handle.Script:14: attempt to index local 'player' (a nil value)..?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.
