Everything is working except for line 9 and 10. I've looked at the output and nothing. I've used the print statement and that didn't help either. Please help me.
script.Parent.RedFlag.Handle.Touched:Connect(function(char)
if char ~= nil then
local player = game.Players:GetPlayerFromCharacter(char.Parent)
if player then--check if they are a player
if char.Parent:FindFirstChild("Humanoid") then
if char.Parent.Humanoid.Health ~= 0 then--if they are still alive
print(player.Name .. " has the Red Flag!")
if char.Parent:FindFirstChild("Humanoid").Health == 0 and char.Parent:FindFirstChild("RedFlag") then--if they die and they have the flag
local FlagClone = game:GetService("ServerStorage"):WaitForChild("RedFlag"):Clone()--the flag gets cloned and put into workspace
FlagClone.Parent = game.Workspace
end
end
end
end
end
wait(2)
end)

5 comments
I will try this and I will get back to you asap
So all you did was replace my line 8 with your line 3?
Kind of. I replaced your if statement with an event connection and moved your if statement down.
Ok
I just tested it out and it works! Thank you so much!! I've been trying to fix this problem forever! Thank you!