Hi, this is pretty related to the other question I asked about how to get humanoid on a server script.
Ok, I figured that out.
But now, I'm stuck with the Timer situation.
There is a timer with 2 minutes and if you die, that timer resets. I just can't do that!
That's Number 1...
Number 2...
The problem is that there is not even an error and the code of the timer on the code block below doesn't work!
--torture time local rep = game:GetService("ReplicatedStorage") local mapsfolder = game:GetService("Lighting"):WaitForChild("Maps") local booleans = rep:WaitForChild("Booleans") local variables = rep:WaitForChild("Variables") local choice1 = variables:FindFirstChild("Choice1") local choice2 = variables:FindFirstChild("Choice2") local choice3 = variables:FindFirstChild("Choice3") local winner = variables:FindFirstChild("Winner") local Alive = workspace.Values.Alive local TimerEnabled = workspace.Values.TimerEnabled local timer = 121 --in seconds 121 while true do while true do local maps = mapsfolder:GetChildren() choice1.Value = maps[math.random(1,#maps)] table.remove(maps,table.find(maps,choice1.Value)) choice2.Value = maps[math.random(1,#maps)] table.remove(maps,table.find(maps,choice2.Value)) choice3.Value = maps[math.random(1,#maps)] table.remove(maps,table.find(maps,choice3.Value)) wait(1) booleans:FindFirstChild("VotingSession").Value = true wait(10) booleans:FindFirstChild("RevealVotes").Value = true wait(5) booleans:FindFirstChild("VotingSession").Value = false booleans:FindFirstChild("RevealVotes").Value = false local chosenmap = winner.Value if not winner.Value then print("Something went wrong!") break end local map = chosenmap.Value local clonemap = map:Clone() print("Getting map...") wait(1) print("Getting map spawn...") if clonemap.Spawn then print("Success!") else print("Task failed successfully") wait() print("Restarting...") clonemap:Destroy() break end clonemap.Parent = workspace clonemap.MusicZone.Stepped.Disabled = true print("Getting players...") local players = game:GetService("Players"):GetPlayers() for x, player in pairs(players) do local char = player.Character if not char then print(player.Name.." has no character!") else local humanoidrootpart = char.HumanoidRootPart if not humanoidrootpart then print(player.Name.." has no HumanoidRootPart!") else wait(1) humanoidrootpart.CFrame = clonemap.Spawn.CFrame + Vector3.new(0,3,0) player.InGame.Value = true workspace.Values.Alive.Value += 1 TimerEnabled.Value = true end end wait() end clonemap.MusicZone.Stepped.Disabled = true wait(12) clonemap.MusicZone.Stepped.Disabled = false --Help me! local Start = clonemap.Start Start.Touched:Connect(function(hit, player) if hit.Start:FindFirstChild("Humanoid") then local char = player.Character local humanoid = char.Humanoid if humanoid.Health <= 0 then Alive.Value -= 1 end end end) Alive:GetPropertyChangedSignal("Value"):Connect(function() if Alive.Value ~= 0 then print("Game is going on...") else clonemap:Destroy() end end) TimerEnabled:GetPropertyChangedSignal("Value"):Connect(function() if TimerEnabled.Value == true then for i = timer,0,-1 do print(i) wait(1) end else clonemap:Destroy() end end) --Help me! for x, player in pairs(players) do local char = player.Character if not char then print(player.Name.." has no character!") else local humanoidrootpart = char.HumanoidRootPart if not humanoidrootpart then print(player.Name.." has no HumanoidRootPart!") else humanoidrootpart.CFrame = workspace.Lobby.SpawnLocation.CFrame + Vector3.new(0,3,0) end end wait() end clonemap:Destroy() end end
Please solve the case between the Help Me's!
Thank you!
Also plz try my game: https://web.roblox.com/games/8090924953/BETA-Insanity-Tower-Escapes
Touched does only have one parameter: hit, not player To get the player, you will need game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
Start.Touched:Connect(function(hit) if hit.Start:FindFirstChild("Humanoid") then local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) local char = player.Character local humanoid = char.Humanoid if humanoid.Health <= 0 then Alive.Value -= 1 end end end)
Oh yeah, here's a tip, you don't need to do :GetPropertyChangedSignal("Value")
on StringValue, BoolValue or NumberValue or any value like that, you just need to use .Changed
, because that does the same thing