|
| 23 Mar 2016 08:59 PM |
| How can I tell when the player re-spawned, after they re-spawn change their walkspeed to saved values..? |
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Mar 2016 09:01 PM |
| It would be a lot easier to do this with PlayerScripts instead of PlayerGui, but you could also just put a NumberValue containing the Walkspeed and set it to that when they spawn. |
|
|
| Report Abuse |
|
|
|
| 23 Mar 2016 09:02 PM |
| Example is all I need, because I already have the values. |
|
|
| Report Abuse |
|
|
Meed
|
  |
| Joined: 26 Dec 2010 |
| Total Posts: 101 |
|
|
| 23 Mar 2016 09:03 PM |
| Player.CharacterAdded:connect() |
|
|
| Report Abuse |
|
|
|
| 23 Mar 2016 09:07 PM |
| Example, of how I would use this in a local script, note: 'StarterGui'. |
|
|
| Report Abuse |
|
|
Meed
|
  |
| Joined: 26 Dec 2010 |
| Total Posts: 101 |
|
|
| 23 Mar 2016 09:11 PM |
| The PlayerGui (Taken from StarterGui) is replaced every single time a character respawns (unless you purposely disable this) so why not just run the save script immediately? |
|
|
| Report Abuse |
|
|
Meed
|
  |
| Joined: 26 Dec 2010 |
| Total Posts: 101 |
|
|
| 23 Mar 2016 09:12 PM |
local Player = Game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:wait() local Humanoid = Character:WaitForChild("Humanoid")
Humanoid.WalkSpeed = MySavedValue.Value |
|
|
| Report Abuse |
|
|
|
| 23 Mar 2016 09:12 PM |
| No Example of how to use this, Im brain dead today. |
|
|
| Report Abuse |
|
|
|
| 23 Mar 2016 09:13 PM |
| I get what you mean, but what if I did disable that? |
|
|
| Report Abuse |
|
|
Meed
|
  |
| Joined: 26 Dec 2010 |
| Total Posts: 101 |
|
|
| 23 Mar 2016 09:15 PM |
| I don't see why you would want to set ResetPlayerGuiOnSpawn to false, have you done that? If not, what I said should work perfectly fine. |
|
|
| Report Abuse |
|
|
Darkenus
|
  |
| Joined: 17 Jul 2014 |
| Total Posts: 1997 |
|
|
| 23 Mar 2016 10:56 PM |
if you did disabled that. then just do something like this
while not game.Players.LocalPlayer do wait() end
local plr = game.Players.LocalPlayer
plr.CharacterAdded:connect(function(plr) --insert walkspeed code here end) |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2016 03:13 PM |
Doesn't Work:
local g = script.Parent:WaitForChild("Speed") local d = script.Parent:WaitForChild("Health") local normwalkspeed = 16 local normHealth = 100
while not game.Players.LocalPlayer do wait() end
local plr = game.Players.LocalPlayer
plr.CharacterAdded:connect(function(plr) plr.Humanoid.WalkSpeed = normwalkspeed + g plr.MaxHealth.WalkSpeed = normHealth + d
end) |
|
|
| Report Abuse |
|
|
xlaser23
|
  |
| Joined: 10 Dec 2011 |
| Total Posts: 20341 |
|
|
| 24 Mar 2016 03:39 PM |
"Doesnt work"
"local plr = game.Players.LocalPlayer<
plr.CharacterAdded:connect(function(plr<) plr.Humanoid.WalkSpeed = normwalkspeed + g plr.MaxHealth.WalkSpeed = normHealth + d
end)"
LOL
http://www.roblox.com/xla-item?id=290739801http://www.roblox.com/aser-item?id=290739819http://www.roblox.com/23-item?id=290739831 R$11,065 Tx651 (づ ゚ ³ ゚)づ |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2016 03:41 PM |
| ;-; forgot to make dat char* |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2016 03:43 PM |
erroring now:
local normwalkspeed = 16 local normHealth = 100 local plr = game.Players.LocalPlayer
plr.CharacterAdded:connect(function(char) local g = script.Parent:WaitForChild("Speed") --Speed is not a valid member of PlayerGui local d = script.Parent:WaitForChild("Health") char.Humanoid.WalkSpeed = normwalkspeed + g.Value --Speed char.Humanoid.MaxHealth = normHealth + d.Value --Speed end) |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 24 Mar 2016 03:48 PM |
local player = game.Players.LocalPlayer local char = player.Character or player.CharacterAdded:wait() local speed = script.Parent:WaitForChild("Speed") local health = script.Parent:WaitForChild("Health")
char.Humanoid.WalkSpeed = 16 + speed char.Humanoid.MaxHealth = 100 + health
--You could even just add the saved values to the walkspeed with out the 16 or 100 because those will already be default after the player respawns. |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2016 03:51 PM |
It prints but now just isnt working:
local normwalkspeed = 16 local normHealth = 100 local plr = game.Players.LocalPlayer
print('Speed: '..script.Parent:WaitForChild('Speed').Value..', Health: '..script.Parent:WaitForChild('Health').Value)
plr.CharacterAdded:connect(function(char) char.Humanoid.WalkSpeed = normwalkspeed + script.Parent:WaitForChild('Speed').Value --Speed char.Humanoid.MaxHealth = normHealth + script.Parent:WaitForChild('Health').Value --Speed end) |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2016 03:52 PM |
| Time that depends on the fact that the gui resets, which it doesn't. |
|
|
| Report Abuse |
|
|
| |
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 24 Mar 2016 04:04 PM |
Lua you just don't understand do you?
--Local script inside PlayerGui
local player = game.Players.LocalPlayer local char = player.Character or player.CharacterAdded:wait() local stats = player:WaitForChild("PlayerStats") local speed = stats:WaitForChild("Speed") local health = stats:WaitForChild("Health")
char.Humanoid.WalkSpeed = char.Humanoid.WalkSpeed + speed.Value char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + health.Value
When the player resets, his speed and health will reset for his humanoid. You can just change his speed based on the value from the datastore that changes some value, lets say inside his playerstats folder |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2016 04:05 PM |
| I understand what you mean, but it was a error on my side... |
|
|
| Report Abuse |
|
|