GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
|
| 14 Sep 2012 11:14 PM |
StarterPack >Local GUI
Weight = script.Parent.leaderstats.Weight
function Weigh(Player)
if Weight.Value == 25 then player.Character.Humanoid.Walkspeed = 14
elseif Weight.Value == 50 then player.Character.Humanoid.Walkspeed = 12
elseif Weight.Value == 75 then player.Character.Humanoid.Walkspeed = 10
elseif Weight.Value == 100 then player.Character.Humanoid.Walkspeed = 8
end end
Output:
23:11:49 - leaderstats is not a valid member of Backpack
X6 times.
I'm not sure why its doing that. Is this script meant for StarterPack or StarterGUI?
I'm new to the whole control player stuff.. |
|
|
| Report Abuse |
|
|
GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
|
| 14 Sep 2012 11:16 PM |
And I'm also getting these two messages...
23:13:10 - leaderstats is not a valid member of Backpack 23:13:10 - Script "Players.Player644.Backpack.LocalScript", Line 1 23:13:10 - stack end
2 second pause.
23:15:08 - Script "CoreGui.RobloxGui.CurrentLoadout.CoreScripts/BackpackScript", Line 517 23:15:08 - stack end
|
|
|
| Report Abuse |
|
|
| |
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 14 Sep 2012 11:46 PM |
Weight = script.Parent.Parent.leaderstats.Weight
|
|
|
| Report Abuse |
|
|
GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
|
| 14 Sep 2012 11:54 PM |
Weight = script.Parent.Parent.leaderstats.Weight
function Weigh(Player)
if Weight.Value == 25 then player.Character.Humanoid.WalkSpeed = 14
elseif Weight.Value == 50 then player.Character.Humanoid.WalkSpeed = 12
elseif Weight.Value == 75 then player.Character.Humanoid.WalkSpeed = 10
elseif Weight.Value == 100 then player.Character.Humanoid.WalkSpeed = 8
end end
Corrected script /\
Output NEW error message:
23:52:43 - Disconnected event because of exception
Is it saying that cause I'm missing a connection line???? (This is not a OnTouch/Click script.)
|
|
|
| Report Abuse |
|
|
|
| 14 Sep 2012 11:57 PM |
I don't know if this is a problem, but in this line:
function Weigh(Player)
You have it as a capital "P"
Just change it to:
function Weigh(player) |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 15 Sep 2012 12:04 AM |
| Yep, he's right. You say player when the parameter is Player. |
|
|
| Report Abuse |
|
|
GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
|
| 15 Sep 2012 12:20 AM |
Weight = script.Parent.Parent.leaderstats.Weight
function Weigh(player)
if Weight.Value == 0 then player.Character.Humanoid.WalkSpeed = 16
elseif Weight.Value == 25 then player.Character.Humanoid.WalkSpeed = 14
elseif Weight.Value == 50 then player.Character.Humanoid.WalkSpeed = 12
elseif Weight.Value == 75 then player.Character.Humanoid.WalkSpeed = 10
elseif Weight.Value == 100 then player.Character.Humanoid.WalkSpeed = 8
end end
Output "leaderstats is not part of Player"
I don't get that. Parenting is right. I think. Is it?
And is this in the right place? (StartPack) |
|
|
| Report Abuse |
|
|
GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
| |
|
|
| 15 Sep 2012 01:11 PM |
It should be right. If it says it's not in the player (which it should be) it probably doesn't load before the leaderstats is created. Add waits, or use the other script I gave you...
† KMXD † |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 15 Sep 2012 01:11 PM |
| Your Parents are wrong. Either that or you need the player to load. One of those two for sure. |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2012 01:16 PM |
@Miz
The latter, as he ended up with the player, where the leaderstats should go.
† KMXD † |
|
|
| Report Abuse |
|
|
GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
|
| 15 Sep 2012 01:57 PM |
So add a wait?
Weight = script.Parent.Parent.leaderstats.Weight
wait(4) --That should be enough. I think
function Weigh(player)
if Weight.Value == 0 then player.Character.Humanoid.WalkSpeed = 16
elseif Weight.Value == 25 then player.Character.Humanoid.WalkSpeed = 14
elseif Weight.Value == 50 then player.Character.Humanoid.WalkSpeed = 12
elseif Weight.Value == 75 then player.Character.Humanoid.WalkSpeed = 10
elseif Weight.Value == 100 then player.Character.Humanoid.WalkSpeed = 8
end end
|
|
|
| Report Abuse |
|
|
|
| 15 Sep 2012 02:08 PM |
Well the whole reason of putting a wait, is to *wait* for the leaderstats, so you'd put the wait before the Weight varaible. If that doesn't work, try:
repeat wait() until script.Parent.Parent:FindFirstChild("leaderstats")
† KMXD † |
|
|
| Report Abuse |
|
|
GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
|
| 15 Sep 2012 06:18 PM |
All right so I added the wait to the top of the script, fixed a miss spell...
Now nothing happens, but there's no error...
NOW I'm going to try KnightmareXD's script line...
And... nothing.
--wait(4) --That should be enough. I think
repeat wait() until script.Parent.Parent:FindFirstChild("leaderstats")
Weight = script.Parent.Parent.leaderstats.Weight
function Weigh(player)
if Weight.Value == 0 then print("Weight 0") player.Character.Humanoid.WalkSpeed = 16
elseif Weight.Value == 25 then print("Weight 25") player.Character.Humanoid.WalkSpeed = 14
elseif Weight.Value == 50 then print("Weight 50") player.Character.Humanoid.WalkSpeed = 12
elseif Weight.Value == 75 then print("Weight 75") player.Character.Humanoid.WalkSpeed = 10
elseif Weight.Value == 100 then print("Weight 100") player.Character.Humanoid.WalkSpeed = 8
end end
So I added the print() stuff to see if anything works... Nope.
No error from out put or anything. I really don't get whats wrong with this. |
|
|
| Report Abuse |
|
|
GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
| |
|
1pie23
|
  |
| Joined: 11 Jul 2010 |
| Total Posts: 1865 |
|
|
| 15 Sep 2012 06:48 PM |
| It infinitely loops because you didn't even parent the stats into the player. |
|
|
| Report Abuse |
|
|
GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
|
| 15 Sep 2012 07:01 PM |
Um..
What? How do I do that? |
|
|
| Report Abuse |
|
|