I have a script that would give XP whenever a tool touches it. Thing is whenever someone's head or body touches it, it breaks. Is there any way to make it so that only when the tool touches it, it will work, not when a player's head touches it.
XP Giver:
local debounce = false
script.Parent.Touched:connect(function(hit)
if not debounce then
debounce = true
local look = hit.Parent:FindFirstChild("BallHandler").Value -- value in basketball
local found = game.Players:FindFirstChild(look)
local cash = found:FindFirstChild("leaderstats")
cash.XP.Value = cash.XP.Value + 5
print("Gave +1 SM")
wait(1)
debounce = false
end
end)
BallHandler Script:
while wait() do
plr=game.Players:FindFirstChild(script.Parent.Parent.Parent.Name)
if plr then
script.Parent.Value=plr.Name
end
end
Thanks,
LukeGabrieI aka EnergyBrickz

4 comments
would i put this in the part thats going to be touched or inside the tool's handle
You would add it inside script.Parent.Touched:connect(function(hit)
thank you so much!
No problem!