|
there is no error in output when i run it in solo mode.
function onPlayerRespawned(newPlayer)
while true do
if newPlayer.TeamColor == game.Teams.Prisoner.TeamColor then
if newPlayer.leaderstats.D.Value >= 0 then
newPlayer.TeamColor = BrickColor.new("Lime green")
newPlayer.leaderstats.D.Value = 0
newPlayer.Character.Humanoid.Health = 0
end end end end |
|
|
Don't keep the ends on one line. Try spacing them
:
function onPlayerRespawned(newPlayer)
while true do
if newPlayer.TeamColor == game.Teams.Prisoner.TeamColor then
if newPlayer.leaderstats.D.Value >= 0 then
newPlayer.TeamColor = BrickColor.new("Lime green")
newPlayer.leaderstats.D.Value = 0
newPlayer.Character.Humanoid.Health = 0
end
end
end
end
--If that doesn't work, try removing an end. |
|
Bannana97Join Date: 2008-06-22 Post Count: 10215 |
You never connected the function to the character. |
|
|
When the player respawns the script should be checking to see if they are on the Prisoner team.
Once that is determined and if the player is on the prisoner team the script should be doing a loop to determine when a prisoners Days reaches 0.
Once a prisoners Days raches 0 the script should change them to the Civilians team, reset there days to 0, and kill the player(so they can go to the correct location and get the civilian on respawn items.
hope this clarifies what im trying to do a little better.. |
|
Bannana97Join Date: 2008-06-22 Post Count: 10215 |
Simply connect that function to the player's respawn event, and then you're good to go. |
|
|
Ahem, connection line pl0x? |
|
|
The script is somewhat working now. The issue im having now is it is not waiting on the days to reach 0 before changing the team. and once it changes team it continues to respawn the player even though they are on the new team.
here is the updated script:
function onPlayerRespawned(newPlayer)
if newPlayer.TeamColor == game.Teams.Prisoner.TeamColor then
while true do
wait(5)
if newPlayer.leaderstats.D.Value >= 0 then
script.TimeServedGUI:Clone().Parent = newPlayer.PlayerGui
newPlayer.TeamColor = game.Teams.Civilian.TeamColor
newPlayer.leaderstats.D.Value = 0
wait(1)
newPlayer.Character.Torso.CFrame = CFrame.new(Vector3.new(-45.15, 209, 252.6))
wait(3)
newPlayer.Character.Humanoid.Health = 0
end
end
end
end
function onPlayerAdded(newPlayer)
newPlayer.Changed:connect(function(property)
if property == "Character" then
onPlayerRespawned(newPlayer)
end
end)
end
game.Players.PlayerAdded:connect(onPlayerAdded)
|
|
|
|
CheaterJoin Date: 2007-06-29 Post Count: 5258 |
That's because you use while true do.
Use return. |
|
|
could you be a little more clear please?
I tried replacing
while true do
end
with
return untill
false
but nothing worked... |
|
|
|
come on guys I know someone has to know how to do this correctly... I have been working in this a while and just cant seem to figure out the reason its not working correctly. |
|
|
stupid typos
... problem solved. |
|