Hello!
What is the best way to make a delay to this script:
for _, TaggedPart in pairs(KillParts) do
TaggedPart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local char = hit.Parent
local plr = game.Players[char.Name]
local Chances = plr:WaitForChild("stats").Chances
local Obby = plr:WaitForChild("stats").Obby
hit.Parent = char
if Chances.Value == -1 then
workspace.Obbies:FindFirstChild(Obby.Value).Parent = ServerStorage.Obbies
for _, SpawnLocation in pairs (workspace.Lobby.SpawnLocations:GetChildren()) do
char.HumanoidRootPart:PivotTo(SpawnLocation.CFrame)
ReplicatedStorage.RemoteEvents.RemoveChallenges:FireClient(plr)
end
else
char.HumanoidRootPart:PivotTo(workspace.Obbies:FindFirstChild(Obby.Value).Teleport.CFrame)
Chances.Value = Chances.Value - 1
end
end
end)
end
I mostly want to apply the delay to Chances.Value = Chances.Value -1
part.
Iām trying to make a chance system. If anyone knows better way to make this please tell me!
Thanks for helping if you do!