XoDust
|
  |
| Joined: 23 Apr 2012 |
| Total Posts: 1401 |
|
|
| 17 Apr 2013 10:49 PM |
clones itself and deletes old script everytime a player dies?
Would that be possible?
Because I have been trying for 3 days for somebody to help fix a script for me but so far the same thing happens - it works fine the first time but no matter what they do it doesn't work when the player respawns
here is the script:
local Name = "Hunger" local Time = 5 local Player = Game.Players.LocalPlayer local Person = Player.Character local Stat = Player.leaderstats[Name]
Stat.Value = 10
while wait(Time) do Stat.Value = Stat.Value - 1 if Stat.Value == 0 then break end end Person:BreakJoints() |
|
|
| Report Abuse |
|
|
|
| 17 Apr 2013 10:56 PM |
Try: local Name = "Hunger" local Time = 5 local Player = game.Players.LocalPlayer local Person = Player.Character local Stat = Player.leaderstats[Name]
Stat.Value = 10
while wait(Time) do Stat.Value = Stat.Value - 1 if Stat.Value == 0 then Person:BreakJoints() --break -- haven't been keeping up with Lua; self taught 7 years ago, not sure if break is necessary or what. end end |
|
|
| Report Abuse |
|
|
XoDust
|
  |
| Joined: 23 Apr 2012 |
| Total Posts: 1401 |
|
|
| 17 Apr 2013 10:59 PM |
Err what did you change in it? |
|
|
| Report Abuse |
|
|
XoDust
|
  |
| Joined: 23 Apr 2012 |
| Total Posts: 1401 |
|
|
| 17 Apr 2013 11:02 PM |
That didn't work :/ Now rather than dying it goes into negatives |
|
|
| Report Abuse |
|
|
|
| 17 Apr 2013 11:04 PM |
Tell me where the script is located and gimmie an Output.
Output: Veiw > Output
Run script
Post error report. |
|
|
| Report Abuse |
|
|
XoDust
|
  |
| Joined: 23 Apr 2012 |
| Total Posts: 1401 |
|
|
| 17 Apr 2013 11:05 PM |
| leaderstats is not a valid member of Player is the output |
|
|
| Report Abuse |
|
|
|
| 17 Apr 2013 11:05 PM |
local Name = "Hunger" local Time = 5 local Player = Game.Players.LocalPlayer local Person = Player.Character local Stat = Player:WaitForChild("leaderstats"):WaitForChild(Name) Stat.Value = 10 while wait(Time) do Stat.Value = Stat.Value - 1 if Stat.Value == 0 then break end end Person:BreakJoints()
Perhaps?
(╯°□°)> KMXD
|
|
|
| Report Abuse |
|
|
XoDust
|
  |
| Joined: 23 Apr 2012 |
| Total Posts: 1401 |
|
|
| 17 Apr 2013 11:06 PM |
23:05:25.567 - leaderstats is not a valid member of Player 23:05:25.568 - Script "local Name = "Hunger" local Time = 5 local Player = game.P", Line 5 23:05:25.570 - stack end |
|
|
| Report Abuse |
|
|
|
| 17 Apr 2013 11:06 PM |
| Try uncommenting the -- I put for break. |
|
|
| Report Abuse |
|
|
|
| 17 Apr 2013 11:07 PM |
Ooh, use Knightmare's with a leaderboard script from the models menu.
|
|
|
| Report Abuse |
|
|
XoDust
|
  |
| Joined: 23 Apr 2012 |
| Total Posts: 1401 |
|
|
| 17 Apr 2013 11:09 PM |
@knight
Same problem
I think problem may be with my leaderboard script gonna check that |
|
|
| Report Abuse |
|
|
|
| 17 Apr 2013 11:10 PM |
That's weird. If it works once, I don't see why it can't find the leaderstats again unless it disappears. . .
(╯°□°)> KMXD |
|
|
| Report Abuse |
|
|
XoDust
|
  |
| Joined: 23 Apr 2012 |
| Total Posts: 1401 |
|
|
| 17 Apr 2013 11:10 PM |
Wait what model menu? Freemodels? |
|
|
| Report Abuse |
|
|
XoDust
|
  |
| Joined: 23 Apr 2012 |
| Total Posts: 1401 |
|
|
| 17 Apr 2013 11:12 PM |
print("Cash Stuffs running!")
function onPlayerEntered(newPlayer) wait(.5) local stats = Instance.new("IntValue") stats.Name = "leaderstats"
stats.Parent = newPlayer
local cash = Instance.new("IntValue")
cash.Name = "Hunger" cash.Value = 10 --This sets the amount of money every player starts with
cash.Parent = stats
stats.Parent = newPlayer
end
game.Players.ChildAdded:connect(onPlayerEntered)
is my current leaderboard script |
|
|
| Report Abuse |
|
|
|
| 17 Apr 2013 11:14 PM |
Change
"local Stat = Player.leaderstats[Name]"
to
local Stat = Player.Hunger |
|
|
| Report Abuse |
|
|
|
| 17 Apr 2013 11:16 PM |
@Killer
But Hunger is parented to Leaderstats.
(╯°□°)> KMXD |
|
|
| Report Abuse |
|
|
|
| 17 Apr 2013 11:18 PM |
I'm not sure if it is right. I'm trying really hard to locate all his variables threw these scripts. I don;t have the actual workspace.
All I know is, leaderstats, is not located in the player. |
|
|
| Report Abuse |
|
|
XoDust
|
  |
| Joined: 23 Apr 2012 |
| Total Posts: 1401 |
|
|
| 17 Apr 2013 11:20 PM |
@Killer Yeah it doesn't work at all now with local Stat = Player.Hunger
|
|
|
| Report Abuse |
|
|
|
| 17 Apr 2013 11:20 PM |
That's the thing; it should be. He's stating it works fine upon first execution, and the code shows the correct parenting. I don't know why the script can't locate the leaderstats again.
(╯°□°)> KMXD |
|
|
| Report Abuse |
|
|
|
| 17 Apr 2013 11:21 PM |
I'd kill to have a picture of your workspace.
The output clearly states, Leaderstats is not inside your player. |
|
|
| Report Abuse |
|
|
XoDust
|
  |
| Joined: 23 Apr 2012 |
| Total Posts: 1401 |
|
|
| 17 Apr 2013 11:21 PM |
Yeah it's strange First attempt it finds it Second and so forth, it can't seem to locate it |
|
|
| Report Abuse |
|
|
|
| 17 Apr 2013 11:21 PM |
Oh, thats different.
Where is this script located?
Workspace? Character? Player? |
|
|
| Report Abuse |
|
|
XoDust
|
  |
| Joined: 23 Apr 2012 |
| Total Posts: 1401 |
|
|
| 17 Apr 2013 11:23 PM |
Location of script:
Game>StarterGUI>LocalScript |
|
|
| Report Abuse |
|
|
XoDust
|
  |
| Joined: 23 Apr 2012 |
| Total Posts: 1401 |
|
|
| 17 Apr 2013 11:24 PM |
It also appears in
Game>Players>XoDust>Player GUI>LocalScript |
|
|
| Report Abuse |
|
|
|
| 17 Apr 2013 11:25 PM |
| I think the break ends the loop |
|
|
| Report Abuse |
|
|