Hey Developers!
I am currently making a story game, and one of the things I am doing is if the player doesn’t find a medkit in 30 Seconds, the allergic player dies. I am attempting to do this with 2 scripts. The Countdown is shown, but after the time runs out, the countdown stays at Zero, nothing else happens.
Here is my First Script:
game.Workspace.Sounds.Action:Play()
SetMessageSpeaker('Guide')
BroadcastMessage('Quick, find '..PoisonedPlayer.Name.." 's backpack! I left it in the offices upstairs somewhere!")
wait(0.5)
game.Workspace.Medkit.Enabled.Value = true
for i = 30,0,-1 do
TopText.Value = i
wait(1)
if game.Workspace.Medkit.Found.Value == true then
break
elseif i == 0 and game.Workspace.Medkit.Found == false then
--Kill the PoisonedPlayer
PoisonedPlayer.Character.Humanoid.Health = 0
end
end
repeat wait(0.1) until game.Workspace.Medkit.Found.Value == true or PoisonedPlayer.Character.Humanoid.Health == 0
game.Workspace.Sounds.Action:Stop()
if game.Workspace.Medkit.Found.Value == true then
SetMessageSpeaker('Guide')
BroadcastMessage('Phew, '..game.Workspace.Medkit.PlayerName.Value..' found '..PoisonedPlayer.Name.." 's Medkit.")
else
SetMessageSpeaker('Guide')
BroadcastMessage('Oh no, '..PoisonedPlayer.Name..' Died, what am I going to say to their parents?')
end
SetMessageSpeaker('Guide')
BroadcastMessage("It's getting late, we should get some sleep.")
Here is the script inside the medkit:
script.Parent.ClickDetector.MouseClick:Connect(function(Player)
if script.Parent.Enabled.Value == true and script.Parent.Found.Value == false then
script.Parent.Enabled.Value = false
script.Parent.Found.Value = true
script.Parent.PlayerName.Value = Player.Name
end
end)
Any Help is appreciated!
I get no errors in the output.