Hello, I’m currently making Tag for my game and I’ve ran into some issues, how it’s supposed to work is when the IT touches a player, the player IT touches becomes the new it.
So currently when you touch a player they don’t become anything, it works on NPCS.
I’ve looked around the DevForum and Scriptinghelpers and tried some stuff but nothing works, it works on NPCS, idk if it’s because the Player Collision is off.
Main code for the IT
task.spawn(function()
while task.wait(0.5) do
if gameStarted == true then
-- Players
task.spawn(function()
for _, player in pairs(plrs) do
if player and player:FindFirstChild("InElevator") and player:FindFirstChild("InElevator").Value == true and table.find(plrs, PlayersService:GetPlayerFromCharacter(player)) then
player.Character:FindFirstChild("Humanoid").Touched:Connect(function(hit)
if hit and hit.Parent:FindFirstChild("Humanoid") and table.find(plrs, PlayersService:GetPlayerFromCharacter(hit.Parent)) then
local plr = PlayersService:GetPlayerFromCharacter(hit.Parent)
if currentIt ~= player.Name then
if currentIt ~= "" and currentIt == plr.Name then
hit.Parent:FindFirstChild("Head"):FindFirstChild("IT"):Destroy()
end
currentIt = player.Name
local cloneIT = tagAssetsFolder:FindFirstChild("IT"):Clone()
cloneIT.Adornee = hit.Parent:FindFirstChild("Head")
cloneIT.Parent = hit.Parent:FindFirstChild("Head")
end
elseif hit and hit.Parent:FindFirstChild("Humanoid") and table.find(noobs, hit.Parent) then
if currentIt ~= player.Name then
local noob = hit.Parent
if currentIt ~= "" and currentIt == noob.Name then
noob:FindFirstChild("Head"):FindFirstChild("IT"):Destroy()
end
currentIt = player.Name
local cloneIT = tagAssetsFolder:FindFirstChild("IT"):Clone()
cloneIT.Adornee = hit.Parent:FindFirstChild("Head")
cloneIT.Parent = hit.Parent:FindFirstChild("Head")
end
end
end)
end
end
end)
-- NPCS/Noobs
task.spawn(function()
for _, noob in pairs(noobs) do
if noob then
if table.find(noobs, noob) then
noob:FindFirstChild("Humanoid").Touched:Connect(function(hit)
if hit and hit.Parent:FindFirstChild("Humanoid") and table.find(plrs, PlayersService:GetPlayerFromCharacter(hit.Parent)) then
local plr = PlayersService:GetPlayerFromCharacter(hit.Parent)
if currentIt ~= noob.Name then
local plr = hit.Parent
if currentIt ~= "" and currentIt == plr.Name then
plr:FindFirstChild("Head"):FindFirstChild("IT"):Destroy()
end
currentIt = noob.Name
local cloneIT = tagAssetsFolder:FindFirstChild("IT"):Clone()
cloneIT.Adornee = noob:FindFirstChild("Head")
cloneIT.Parent = noob:FindFirstChild("Head")
end
elseif hit and hit.Parent:FindFirstChild("Humanoid") and table.find(noobs, hit.Parent) then
if currentIt ~= noob.Name then
local noobIT = hit.Parent
if currentIt ~= "" and currentIt == noobIT.Name then
noobIT:FindFirstChild("Head"):FindFirstChild("IT"):Destroy()
end
currentIt = noob.Name
local cloneIT = tagAssetsFolder:FindFirstChild("IT"):Clone()
cloneIT.Adornee = noob:FindFirstChild("Head")
cloneIT.Parent = noob:FindFirstChild("Head")
end
end
end)
end
end
end
end)
print(currentIt)
print("Plrs: "..#plrs)
print("Noobs: "..#noobs)
print("Available Plrs: "..#availablePlrs)
end
end
end)
If you have any questions please ask!