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

Lives script isn't working. Help?

Asked by 10 years ago

I am making a lives system, and currently, I cannot get it to work. If anyone knows how to get this to work, it'd be much appreciated. Basically, if the value of "lives" is zero, it will put you on the first spawn point, and inside the GUI, the textlabel named "Text" will change according to the value.

local lives = script.Parent.Lives


if lives.Value = 0 then
    player.Team = "Level One"
end



local LD = script.Parent.Parent.LivesDisplay
local text = script.Parent.lives.text

end

1 answer

Log in to vote
0
Answered by
Tesouro 407 Moderation Voter
10 years ago
local lives = script.Parent.Lives

if lives.Value == 0 then -- two = for if
    player.TeamColor = BrickColor.new("The color of Level One team") -- teams are set by colors, to change a player team you change its TeamColor property
end -- this end is closing the if statement, you don't need one to finish the script

local LD = script.Parent.Parent.LivesDisplay
local text = script.Parent.lives.Value -- wasn't lives a value? so text isn't a property of it, [Value](http://wiki.roblox.com/index.php?title=Value) is

Independent of what kind of value lives is, you will have to transform it into a string (the same kind as the TextLabel text), like this:

LD.Text = tostring(text) -- just made the text (that is lives value) a string, so it can change the TextLabel

You should check these pages on the wiki, I recommend:

0
Also, it won't change every time with this simple script, you will need a function connected to an event: http://wiki.roblox.com/index.php?title=Event Tesouro 407 — 10y
Ad

Answer this question