--Remember to add IsPlayer variables inside the character
function onTouch(hit)
--your things
end
function offTouch(hit)
--your things
end
script.Parent.Touched:Connect(function(hit)
if hit.parent:FindFirstChild("IsPlayer") then
onTouch(hit)
end
end)
script.Parent.TouchEnded:Connect(function(hit)
if hit.parent:FindFirstChild("IsPlayer") then
onTouch(hit)
end
end)
yeah, you can, but if you want to add bots into your game then use IsPlayer, and remember use FindFirstChildWhichIsA(“Humanoid”), bc there’s some avatar item name Humanoid
You should put prints in the code to get to the root of the problem, start with something like this
function offTouch(hit)
local user = game.Players:GetPlayerFromCharacter(hit.Parent)
if user ~= nil then
user.leaderstats.Capturing.Value = 0
elseif user == nil then
print("its nil")
end
end