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

Script add on help?

hint = Instance.new("Hint")
hint.Parent = game.Workspace
hint.Name = "Hinty"
Players = game.Players

for _, v in pairs (game:GetService('Players'):GetPlayers()) do 
local Alive = Instance.new("BoolValue")
Alive.Parent = v
Alive.Value = true
Alive.Name = "Alive"
v.Character.Torso.CFrame = CFrame.new(10,10,10)
local character = v.Character
character:WaitForChild("Humanoid").Died:connect(function() 
if Alive.Value == true then 
Alive.Value = false
game.Workspace.Alive.Value = game.Workspace.Alive.Value - 1
end
end)
end 

So basically this works^^. But what could I add that Creates a Instance.new("Message") and says who survived after a amount of time. Or if their is one player left it says who it is? Please help.

1 answer



Players = game.Players --u created a variable so why not use it?
for _, v in pairs (Players:GetPlayers()) do --let's replace a bit here
local Alive = Instance.new("BoolValue")
Alive.Parent = v
Alive.Value = true
Alive.Name = "Alive"
v.Character.Torso.CFrame = CFrame.new(10,10,10)
local character = v.Character
character:WaitForChild("Humanoid").Died:connect(function() 
if Alive.Value == true then --We manipulate the BoolValue to identify the person specifically
local x = Instance.new("Message",Workspace)
x.Text = "Player Alive:".. v.Name --We use the variable we created to define the name of the player whose alive.
else
Alive.Value = false
game.Workspace.Alive.Value = game.Workspace.Alive.Value - 1
end
end)
end --Hope this helped if it did leave a Accept thank you.



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