Script doe's not reset when victim dies [Solved!]

Doe’s not work either
(30 words requirement)

1 Like

I give me another errror

Student is not a valid member of Player “Players.Puma_incredible”

even though there was a elseif statement to prevent this

1 Like

start from scratch :sob::sob::sob:

edwrgsovgrdfwmarWGSMK

2 Likes

I can’t I already have much to do on the game I’m working on to where I can’t restart this script from scratch

1 Like

Some changes again to the old one

local Players = game.Players:GetPlayers()
local Sounds = script:WaitForChild("Playtime Sounds")
local HitBox = script.Parent
local Playtimegui = game.StarterGui:WaitForChild("Playtime ui")
local Rope = Playtimegui:WaitForChild("Rope")
local minigameprogress = script:WaitForChild("minigameprogress")
local minigameprogresstext = Playtimegui.Frame:WaitForChild("minigameprogress")
local contentloader = game:GetService("ContentProvider")
local isplaytimeavailable = true
local Minigamecompleted = false

Sounds["Playtime's Theme"]:Play()

local Ropeassets = {
    "rbxassetid://17309020766",
    "rbxassetid://17309020583",
    "rbxassetid://17309020358",    
    "rbxassetid://17309020210",
    "rbxassetid://17309020023"
}

local Playtimesoundsassets = {
    "rbxassetid://17311954085",
    "rbxassetid://17311953908",
    "rbxassetid://17311953569",
    "rbxassetid://17311953180",
    "rbxassetid://17311953378"
}

contentloader:PreloadAsync(Ropeassets)
contentloader:PreloadAsync(Playtimesoundsassets)

HitBox.Touched:Connect(function(part)
    local plr = game:GetService("Players"):GetPlayerFromCharacter(part.Parent)
    if plr and isplaytimeavailable then
        if plr:FindFirstChild("Student") and plr:FindFirstChild("isplaying") then
            if plr.isplaying.Value == false then
                plr.isplaying.Value = true
                isplaytimeavailable = false
                wait(0.2)
                plr.Character.Humanoid.WalkSpeed = 0
                plr.Character.Humanoid.JumpPower = 40
                Sounds["Playtime ready go!"]:Play()
                plr.PlayerGui["Playtime ui"].Enabled = true
                Sounds["Playtime ready go!"]:Play()
                wait(Sounds["Playtime ready go!"].TimeLength)
                minigame(plr)
            end
        else    
            print("Player either doesn't have Student or is already playing with playtime!")
        end    
    end
end)

function minigame(plr)
    repeat    
        if plr.Character and plr.Student then
            repeat
                plr.PlayerGui["Playtime ui"].Frame.minigameprogress.Text = "0"
                plr.PlayerGui["Playtime ui"].Rope.Image = "rbxassetid://17309020766"
                wait(0.3)
                plr.PlayerGui["Playtime ui"].Rope.Image = "rbxassetid://17309020583"
                wait(0.3)
                plr.PlayerGui["Playtime ui"].Rope.Image = "rbxassetid://17309020358"
                wait(0.3)
                plr.PlayerGui["Playtime ui"].Rope.Image = "rbxassetid://17309020210"
                wait(0.3)
                plr.PlayerGui["Playtime ui"].Rope.Image = "rbxassetid://17309020023"
                wait(0.3)
                plr.PlayerGui["Playtime ui"].Rope.Image = ""
                if plr.Character.Humanoid:GetState() == Enum.HumanoidStateType.Jumping or plr.Character.Humanoid:GetState() == Enum.HumanoidStateType.Freefall then
                    if minigameprogress.Value == 0 then
                        Sounds["Playtime 1"]:Play()
                        minigameprogress.Value = minigameprogress.Value + 1
                        plr.PlayerGui["Playtime ui"].Frame.minigameprogress.Text = "1"
                    elseif minigameprogress.Value == 1 then
                        Sounds["Playtime 2"]:Play()
                        minigameprogress.Value = minigameprogress.Value + 1
                        plr.PlayerGui["Playtime ui"].Frame.minigameprogress.Text = "2"
                    elseif minigameprogress.Value == 2 then
                        minigameprogress.Value = minigameprogress.Value + 1
                        Sounds["Playtime 3"]:Play()
                        plr.PlayerGui["Playtime ui"].Frame.minigameprogress.Text = "3"    
                    elseif minigameprogress.Value == 3 then
                        minigameprogress.Value = minigameprogress.Value + 1
                        Sounds["Playtime 4"]:Play()
                        plr.PlayerGui["Playtime ui"].Frame.minigameprogress.Text = "4"
                    elseif minigameprogress.Value == 4 then
                        minigameprogress.Value = minigameprogress.Value + 1
                        Sounds["Playtime 5"]:Play()
                        plr.PlayerGui["Playtime ui"].Frame.minigameprogress.Text = "5"
                        Minigamecompleted = true
                        plr.isplaying.Value = false
                        plr.PlayerGui["Playtime ui"].Enabled = false
                        plr.PlayerGui["Playtime ui"].Frame.minigameprogress.Text = "0"
                    end            
                else
                    minigameprogress.Value = 0
                    plr.PlayerGui["Playtime ui"].Frame.minigameprogress.Text = "0"    
                    Sounds["Playtime oops!"]:Play()
                    wait(Sounds["Playtime oops!"].TimeLength)    
                end
            until Minigamecompleted == true or not plr.Character
        end
        
        if not plr.Character or not plr.Student then
            plr.PlayerGui["Playtime ui"].Enabled = false
            minigameprogress.Value = 0
            plr.PlayerGui["Playtime ui"].Rope.Image = ""
            Minigamecompleted = false
            plr.isplaying.Value = false    
            wait(3)    
            break
        end
    until plr.isplaying.Value == false
    
    wait(3)
    
    minigameprogress.Value = 0
    Minigamecompleted = false
    isplaytimeavailable = true
end
1 Like

Doe’s not fix the problem either

After I made a few little changes the script works! except for one error however I’ma try and fix it myself!!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.