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: Player Respawned (Local Script, StarterGui)

Previous Thread :: Next Thread 
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
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
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
23 Mar 2016 09:01 PM
#HelpPlease
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
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
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
23 Mar 2016 09:02 PM
Example is all I need, because I already have the values.
Report Abuse
Meed is not online. Meed
Joined: 26 Dec 2010
Total Posts: 101
23 Mar 2016 09:03 PM
Player.CharacterAdded:connect()
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
23 Mar 2016 09:07 PM
Example, of how I would use this in a local script, note: 'StarterGui'.
Report Abuse
Meed is not online. 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 is not online. 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
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
23 Mar 2016 09:12 PM
No Example of how to use this, Im brain dead today.
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
23 Mar 2016 09:13 PM
I get what you mean, but what if I did disable that?
Report Abuse
Meed is not online. 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 is not online. 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
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
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 is not online. 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
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
24 Mar 2016 03:41 PM
;-; forgot to make dat char*
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
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 is not online. 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
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
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
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
24 Mar 2016 03:52 PM
Time that depends on the fact that the gui resets, which it doesn't.
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
24 Mar 2016 04:00 PM
-Fixed it-
Report Abuse
TimeTicks is not online. 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
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
24 Mar 2016 04:05 PM
I understand what you mean, but it was a error on my side...
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