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 » Scripting Helpers
Home Search
 

Re: I need help with this script.

Previous Thread :: Next Thread 
Adam2090 is not online. Adam2090
Joined: 19 Jul 2010
Total Posts: 889
24 Aug 2013 08:15 AM
This script below, what I need it to do is: When a player dies, the GUI number resets at zero. The leaderboard number stays at what they had. Does anybody know how to make it store the value of the text in the GUI and put the value of the text into the GUI after the player respawns? Thanks

Here is the code:

local mc = script.Parent
local yes = 0
function onTouched(hit)
if yes == 0 then
yes = 1
check = hit.Parent:FindFirstChild("Humanoid")

if check ~= nil then
local user = game.Players:GetPlayerFromCharacter(hit.Parent)
local stats = user:findFirstChild("leaderstats")

if stats ~= nil then
local cash = stats:findFirstChild("Caps")
cash.Value = cash.Value +1
user.PlayerGui.Welcome.Frame.Body.Text = user.PlayerGui.Welcome.Frame.Body.Text +1


mc.Parent = Lighting
wait(5)
mc.Parent = Workspace
end

end
yes = 0
end
end
script.Parent.Touched:connect(onTouched)
Report Abuse
Adam2090 is not online. Adam2090
Joined: 19 Jul 2010
Total Posts: 889
24 Aug 2013 08:23 AM
Bump
Report Abuse
mrwar117 is not online. mrwar117
Joined: 16 Oct 2009
Total Posts: 224
24 Aug 2013 08:25 AM
im not sure but i would try to add a clone() and make it copy what has the value then when respawned it can remove the startergui and add the cloned one back
Report Abuse
Adam2090 is not online. Adam2090
Joined: 19 Jul 2010
Total Posts: 889
24 Aug 2013 08:36 AM
How do you do that?
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
24 Aug 2013 08:38 AM
1)
"user.PlayerGui.Welcome.Frame.Body.Text = user.PlayerGui.Welcome.Frame.Body.Text +1"

How does that even work? Adding a number to a string...

2)
Simply put a line, at the top of a script, within the player's GUI, which sets the text to the player's current cap amount.

__EXAMPLE__
user.PlayerGui.Welcome.Frame.Body.Text = "Caps: "..user.leadertstas.Caps
Report Abuse
Adam2090 is not online. Adam2090
Joined: 19 Jul 2010
Total Posts: 889
24 Aug 2013 08:50 AM
That doesn't work. When I touch the cap nothing happens.
Report Abuse
Adam2090 is not online. Adam2090
Joined: 19 Jul 2010
Total Posts: 889
24 Aug 2013 08:57 AM
Bump
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
24 Aug 2013 09:04 AM
user.PlayerGui.Welcome.Frame.Body.Text = user.PlayerGui.Welcome.Frame.Body.Text +1 --> user.PlayerGui.Welcome.Frame.Body.Text = cash.Value

...?
Report Abuse
Adam2090 is not online. Adam2090
Joined: 19 Jul 2010
Total Posts: 889
24 Aug 2013 09:09 AM
That works. Thanks so much.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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