generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: This script...

Previous Thread :: Next Thread 
Iliuminatis is not online. Iliuminatis
Joined: 30 Nov 2008
Total Posts: 1524
27 Jul 2015 02:12 AM
function Spawned(player)
wait()
if player:findFirstChild("leaderstats") ~= nil then
player.leaderstats:remove()
end

stats = Instance.new("IntValue")
stats.Parent = player
stats.Name = "leaderstats"

money = Instance.new("IntValue")
money.Parent = stats
money.Name = "Exp"
money.Value = 1000

player.Character.Humanoid.MaxHealth = money.Value
player.Character.Humanoid.Health = money.Value
end

game.Players.PlayerAdded:connect(Spawned)

c = game.Players:GetChildren()
for i=1, #c do
Spawned(c[i])
end




~Why it doesn't work the way I want? It's suppose to change player health even after it's respawn, but it works only when the player first time enters the server, after death this script doesn't work.
Report Abuse
systematicaddict is not online. systematicaddict
Joined: 13 Jul 2012
Total Posts: 4188
27 Jul 2015 02:19 AM
you need to run the function every time the Character's Humanoid dies, not loop it through all the players

that doesn't make any sense
Report Abuse
ShungTzu is not online. ShungTzu
Joined: 14 Jun 2014
Total Posts: 959
27 Jul 2015 02:30 AM
Interesting how "supposed", the subjective substitute for the more objective "ought" is so much more often than not supplanted by the, nearly always incorrectly imposed, present perfect tensed, "suppose".
Report Abuse
Iliuminatis is not online. Iliuminatis
Joined: 30 Nov 2008
Total Posts: 1524
27 Jul 2015 02:38 AM
I changed "Spawned" function to "onRespawn" nothing works. I still can't understand why.
Report Abuse
systematicaddict is not online. systematicaddict
Joined: 13 Jul 2012
Total Posts: 4188
27 Jul 2015 02:42 AM
the name of the function literally doesn't matter, it doesn't effect anything

you need to call the function on the event that their Humanoid dies
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image