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: This one script I have broke.

Previous Thread :: Next Thread 
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
14 May 2012 03:17 PM
I'm not a very experienced scripter but I can make a few simple things. This script I made is suppose to lower the "Hunger" value by 1 every 5 seconds. It doesn't appear to work though. If you can help me out I would really appreciate it.


player = script.Parent
Hunger = player.leaderstats.Hunger
amount = 1



while true do
wait(5)
Hunger.Value - amount
end


==~ 29532/50000 Robux ~==
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
14 May 2012 03:20 PM
Hunger.Value = Hunder.Value - amount


† KMXD †
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
14 May 2012 03:20 PM
Sorry, typo.

Hunger.Value = Hunger.Value - amount


† KMXD †
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
14 May 2012 03:21 PM
I'll try it.

==~ 29532/50000 Robux ~==
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
14 May 2012 03:22 PM
No it doesn't work. It actually seems it takes the leader board like 5 seconds to load up. Hmmmm...

==~ 29532/50000 Robux ~==
Report Abuse
Dragonstar1433 is not online. Dragonstar1433
Joined: 18 Sep 2011
Total Posts: 272
14 May 2012 03:24 PM
Uhhhhh how is hunger in a leaderstats it would be easier in a gui :D

Hunger = player.leaderstats.Hunger


-x-X- DERP THE DRAGON -X-x-
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
14 May 2012 03:24 PM
Where is this script located, and how did you put it there?

† KMXD †
Report Abuse
Dragonstar1433 is not online. Dragonstar1433
Joined: 18 Sep 2011
Total Posts: 272
14 May 2012 03:25 PM
Also you never put a function to declare what player is :/ try adding function for player like playeradded i really dont know
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
14 May 2012 03:26 PM
Workspace. I got this in Output

leaderstats is not a valid member of Workspace
Script "Workspace.script", Line 2
stack end


@other guy I don't know how to do GUIs ;/

==~ 29532/50000 Robux ~==
Report Abuse
Dragonstar1433 is not online. Dragonstar1433
Joined: 18 Sep 2011
Total Posts: 272
14 May 2012 03:28 PM
You put player player is in game.Players put
game.Workspace.leaderstats
Report Abuse
Dragonstar1433 is not online. Dragonstar1433
Joined: 18 Sep 2011
Total Posts: 272
14 May 2012 03:29 PM
Also Playerstats is on everyones screen :D
Report Abuse
Dragonstar1433 is not online. Dragonstar1433
Joined: 18 Sep 2011
Total Posts: 272
14 May 2012 03:31 PM
*Leaderstats
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
14 May 2012 03:31 PM
Workspace.script:2: '=' expected near 'player'

I got this now.

==~ 29532/50000 Robux ~==
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
14 May 2012 03:32 PM
And I can't do GUIs ;/ I might try it later but for now I'll do leaderstats.

==~ 29532/50000 Robux ~==
Report Abuse
Dragonstar1433 is not online. Dragonstar1433
Joined: 18 Sep 2011
Total Posts: 272
14 May 2012 03:33 PM
try removing the player = thing
Report Abuse
velibor is not online. velibor
Joined: 24 Nov 2009
Total Posts: 1003
14 May 2012 03:35 PM
Alright. Let's make it simple and organized

1) We make the leaderboard setup script (Inside workspace, Normal script)
Game.Players.PlayerAdded;connect(function(new)
print("Welcome "..new.Name.." to the Server !")
led = Instance.new("IntValue", new)
led.Name = "leaderstats"
val = Instance.new("NumberValue", new)
val.Name = "Hunger"
local k = Game.Lighting.Loop:clone().Parent = new
k.Disabled = false
end)

2) Now we create a Script for our Loop that we clone inside Every player. (Name : Loop, In Lighting , LocalScript)

Plr = game.Players.LocalPlayer

while wait(1) do
if Plr.leaderstats.Hunger.Value == 0 then
print("We got a Sitaution !")
else
Plr.leaderstats.Hunger.Value = Plr.leaderstats.Hunger.Value - 1
end
end

Put instead of print("We got a Sitaution") the action that it should do when we have 0 Hunger ;-)

Glad to help,
Velibor


Report Abuse
Dragonstar1433 is not online. Dragonstar1433
Joined: 18 Sep 2011
Total Posts: 272
14 May 2012 03:36 PM
Hunger = game.Workspace.leaderstats.Hunger
amount = 1

while true do
wait(5)
Hunger.Value - amount
end
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
14 May 2012 03:36 PM
So far I'm at this

game.Workspace.leaderstats
script.Parent
Hunger = player.leaderstats.Hunger
amount = 1



while true do
wait(5)
Hunger.Value = Hunger.Value - amount
end

Output told me this: Workspace.script:2: '=' expected near 'script'


==~ 29532/50000 Robux ~==
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
14 May 2012 03:41 PM
@Velilbor

You want me to paste both of those codes into the same script right? If so, output tole me:

Workspace.script:1: '=' expected near ';'

==~ 29532/50000 Robux ~==
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
14 May 2012 03:44 PM
He made a typo.

Game.Players.PlayerAdded:connect(function(new)

And no, two different scripts. I don't know what the other guy was saying, but is is pretty off.

† KMXD †
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
14 May 2012 03:45 PM
Yeah I could tell.

==~ 29532/50000 Robux ~==
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
14 May 2012 03:48 PM
16:47:20 - Workspace.Script1:1: '=' expected near 'make'
16:47:21 - Workspace.Script2:3: attempt to index global 'Plr' (a nil value)
16:47:21 - Script "Workspace.Script2", Line 3
16:47:21 - stack end

Script1 is the first part and 2 is the second.

==~ 29532/50000 Robux ~==
Report Abuse
Dragonstar1433 is not online. Dragonstar1433
Joined: 18 Sep 2011
Total Posts: 272
14 May 2012 03:48 PM
Hunger = game.Workspace.leaderstats.Hunger
amount = 1

while true do
wait(5)
Hunger.Value - amount
end
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
14 May 2012 03:49 PM
Did you copy the first script correctly...?

† KMXD †
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
14 May 2012 03:49 PM
@Dragon

Your script(s) wouldn't work.

† KMXD †
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