Hi, I'm making a tag game, but my script seems to just not register the Touched event. I have a print to detect, but I never see anything in the console! I use a Tool for the tagger.
Here's my script:
Humanoid = script.Parent:WaitForChild("Humanoid")
local debounce = false
function award(plr)
if not game.BadgeService:UserHasBadgeAsync(plr.UserId, 2124571974) then
game.BadgeService:AwardBadge(plr.UserId, 2124571974)
end
end
function onTouch(hit)
if debounce == false then
debounce = true
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local currentplayer = game.Players:GetPlayerFromCharacter(script.Parent)
if player then
if currentplayer then
if hit.Parent.Name == "Tool" then
print(currentplayer .. " was tagged!")
currentplayer.Character:BreakJoints()
end
if currentplayer.TeamColor == BrickColor.new("Really red") then
if player.UserId == 111255307 then
award(currentplayer)
elseif player.UserId == 424716966 then
award(currentplayer)
elseif player.UserId == 109352342 then
award(currentplayer)
end
end
end
end
wait(2)
debounce = false
end
end
if Humanoid.RigType == Enum.HumanoidRigType.R6 then
script.Parent:WaitForChild("Torso").Touched:Connect(onTouch)
else
script.Parent:WaitForChild("UpperTorso").Touched:Connect(onTouch)
end
while true do
wait(0.1)
Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
end
Please help me with this, as my game is currently unplayable.
