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
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 889 |
|
| |
|
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
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 889 |
|
| |
|
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
|
  |
| 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
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 889 |
|
| |
|
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
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 889 |
|
|
| 24 Aug 2013 09:09 AM |
| That works. Thanks so much. |
|
|
| Report Abuse |
|
|