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: Help Please..

Previous Thread :: Next Thread 
GUESTHAXX is not online. 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 is not online. 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
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
14 Sep 2012 11:21 PM
WalkSpeed not Walkspeed
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
14 Sep 2012 11:46 PM
Weight = script.Parent.Parent.leaderstats.Weight

Report Abuse
GUESTHAXX is not online. 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
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
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 is not online. 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 is not online. 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 is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
15 Sep 2012 01:08 PM
bump
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
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 is not online. 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
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
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 is not online. 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
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
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 is not online. 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 is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
15 Sep 2012 06:46 PM
...
Report Abuse
1pie23 is not online. 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 is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
15 Sep 2012 07:01 PM
Um..

What? How do I do that?
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