Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I have this script and i want it so when the player wins,the players fall and die, any help?

Asked by 4 years ago
-- Bind function to finish part
finish.Touched:connect(function(hit)
    -- check if player hit finish line
    if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
        -- check if player missed any checkpoints
        local finished = true
        local playerName = game.Players:GetPlayerFromCharacter(hit.Parent).Name
        for _, checkpoint in pairs(checkpoints) do
            if not checkpoint:FindFirstChild(playerName) then
                finished = false
                return
            end
        end
        if finished and not raceOver then
            raceOver = true
            local message = Instance.new("Message", game.Workspace)
            message.Text = playerName .. " Wins!"
            wait(5)
            message:Destroy()
        end
    end
end)
0
removed the old one because of too much code (My mistake!) Anxinito 6 — 4y
0
I can post some more code, if its ok with you? Anxinito 6 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

With this code given so far, I cannot make the players fall and die. However, I can make a respawn code:

for i,v in pairs(game:GetService'Players':GetPlayers()) do--for every player:
v:LoadCharacter()--respawn them.
end
0
script* Jack_Hase 85 — 4y
Ad

Answer this question