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

Why is this Touch script not working?

Asked by
Sineo 5
8 years ago

I am trying to make this script so that when the parent is touched it will clone the scripts children which are tools into the StarterPack of the player who touched i,it does nothing when the parent is touched and I am not sure why

local debounce = false
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") 
if (human ~= nil) and debounce == false then

debounce = true

 local player = getPlayer(human) 

 if (player == nil) then return end 

script.Children:clone().Parent = player.StarterPack

wait(2)
 debounce = false
 end
 end

script.Parent.Touched:connect(onTouch) 
0
Output? Any specific area which does/does not work? iFlusters 355 — 8y
0
It does absolutely nothing when the parent o the script is touched Sineo 5 — 8y

Answer this question