Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

-- 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)

2 comments

0

removed the old one because of too much code (My mistake!)

0

I can post some more code, if its ok with you?

1 answer

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

1 comment

0

script*

This discussion is preserved as it was. New answers, comments, and votes are closed.