Sapidum
|
  |
| Joined: 27 Aug 2011 |
| Total Posts: 735 |
|
|
| 27 Sep 2011 01:01 PM |
| First of all, I have a script that dosen't work. But instead of just looking over it and then leaving or just posting something like "dunno", please tell me if I should actually post it. And yes, I expect you to know to script. |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 27 Sep 2011 01:02 PM |
| Duh, and when you run it, post the Output (Veiw -> Output) |
|
|
| Report Abuse |
|
|
Sapidum
|
  |
| Joined: 27 Aug 2011 |
| Total Posts: 735 |
|
|
| 27 Sep 2011 01:03 PM |
| Of course I use the output, read the title, I have no specific error. Actually, no error at all. |
|
|
| Report Abuse |
|
|
Fl0x
|
  |
| Joined: 06 Aug 2010 |
| Total Posts: 5169 |
|
|
| 27 Sep 2011 01:04 PM |
Then it works. PROBLEM SOLVED. /endthread |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 27 Sep 2011 01:05 PM |
| @ fl0x, somtimes the output reports a script is working but nothing actually happens. Post the script and we could point out errors that the Output couldn't notice. |
|
|
| Report Abuse |
|
|
Sapidum
|
  |
| Joined: 27 Aug 2011 |
| Total Posts: 735 |
|
|
| 27 Sep 2011 01:06 PM |
| It dosen't work. D'Oh read the title! |
|
|
| Report Abuse |
|
|
Sapidum
|
  |
| Joined: 27 Aug 2011 |
| Total Posts: 735 |
|
|
| 27 Sep 2011 01:07 PM |
I;n trying to remake an old game, this is the script:
--------------------------------------------------------------
print("God of Fire script running!")
year = 1 time = 60 coal = time/2 msg = game.Workspace.Hint
function resetGame() wait(3) year = 1 time = 60 coal = time/2 msg.Text = "You managed to survive" ..year.. "years!" end
function godNotPleased() msg.Text = "God of Fire is NOT pleased! You're no longer guardians of fire!" local nubz = game.Players:GetChildren() for x = 1, #nubz do local torso = nubz[x].Character.Torso game.Lighting.Explode:clone().Parent = torso wait() torso.Parent.Humanoid.Health = 0 resetGame() end end
function godIsPleased() msg.Text = "God of Fire is pleased! You shall remain guardians of fire!" year = year + 1 time = time * 2 coal = time/2 game.Workspace.TreeSeed.Enabled = true wait(5) game.Workspace.TreeSeed.Enabled = false end
function startGame() while true do wait(1) time = time - 1 end msg.Text = "The God demands" ..coal.. "pieces of coal within" ..time.. "seconds!" wait(time) if time == 0 and game.Workspace.Altar.CoalValue.Value >= coal then godIsPleased() elseif time == 0 and game.Workspace.Altar.CoalValue < coal then godNotPleased() end end
if game.Players > 0 then startGame() end
|
|
|
| Report Abuse |
|
|
Fl0x
|
  |
| Joined: 06 Aug 2010 |
| Total Posts: 5169 |
|
|
| 27 Sep 2011 01:08 PM |
If it has no reported errors; It runs, meaning that it works. You _cannot_ prove me wrong. If your script doesn't work the way you want, tell us what it should do, and we (I) may think about it. |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 27 Sep 2011 01:08 PM |
the bottom:
if game.Players > 0 then.. that won't work, that's why the script isn't working. |
|
|
| Report Abuse |
|
|
Sapidum
|
  |
| Joined: 27 Aug 2011 |
| Total Posts: 735 |
|
|
| 27 Sep 2011 01:09 PM |
| Actually, the hint in the workspace just won't change. That's my only problem |
|
|
| Report Abuse |
|
|
Sapidum
|
  |
| Joined: 27 Aug 2011 |
| Total Posts: 735 |
|
|
| 27 Sep 2011 01:09 PM |
| That dosen't matter so much, i changed it to game.Players.NumPlayers but still won't work |
|
|
| Report Abuse |
|
|
Fredfishy
|
  |
| Joined: 21 Mar 2009 |
| Total Posts: 4197 |
|
|
| 27 Sep 2011 01:10 PM |
| Try shoving in some prints after each of the "if"s. |
|
|
| Report Abuse |
|
|
Sapidum
|
  |
| Joined: 27 Aug 2011 |
| Total Posts: 735 |
|
| |
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 27 Sep 2011 01:12 PM |
| It does, because if a print command DOSEN'T print, then you can see where the errors are. |
|
|
| Report Abuse |
|
|
Sapidum
|
  |
| Joined: 27 Aug 2011 |
| Total Posts: 735 |
|
|
| 27 Sep 2011 01:13 PM |
| Still nothing happens. Test it yourself and to see if it works |
|
|
| Report Abuse |
|
|
Sapidum
|
  |
| Joined: 27 Aug 2011 |
| Total Posts: 735 |
|
| |
|
Sapidum
|
  |
| Joined: 27 Aug 2011 |
| Total Posts: 735 |
|
| |
|
Fredfishy
|
  |
| Joined: 21 Mar 2009 |
| Total Posts: 4197 |
|
|
| 27 Sep 2011 01:24 PM |
| @Sap, because then you can see exactly where the script stops working as planned. |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2011 01:36 PM |
...
Nah, your actual problem is that the script aint working at all 1. It wouldnt run the startgame in the first place 2. It would get stuck in a infinite loop 3. And other stuff...
So, I TRIED to fix it I hope i explained every change i did :o
print("God of Fire script running!")
year = 1 maxtime = 60 -- In "GodIsPleased" function its trying to set the Time to time*2.. Bad for you, but by the time its done, the "time" is 0, so lets use this variable to check the time to see what to *2 :) time = 60 coal = time/2 if not workspace:FindFirstChild("Hint") then -- Creates the hint if it doesnt exist already :) Instance.new("Hint",workspace).Name = "Hint" end msg = game.Workspace.Hint
function resetGame() wait(3) msg.Text = "You managed to survive" ..year.. "years!" -- This needs to be before setting "year" to 1... year = 1 time = 60 maxtime = 60 coal = time/2 game.Workspace.Altar.CoalValue.Value = 0 -- Reseting the coal amount thats already put in. end
function godNotPleased() msg.Text = "God of Fire is NOT pleased! You're no longer guardians of fire!" local nubz = game.Players:GetChildren() for x = 1, #nubz do if nubz[x].Character then -- Gotta make sure the character exists... local torso = nubz[x].Character.Torso local explode = game.Lighting.Explode:clone() explode.Position = torso.Position -- Only parenting isnt enough, you need to set the position too explode.Parent = torso torso.Parent.Humanoid.Health = 0 end end resetGame() -- This needs to be out of the loop, or it would ResetGame for every player online end
function godIsPleased() msg.Text = "God of Fire is pleased! You shall remain guardians of fire!" year = year + 1 maxtime = maxtime*2 time = maxtime coal = time/2 game.Workspace.Altar.CoalValue.Value = 0 -- Reseting the coal amount thats already put in. game.Workspace.TreeSeed.Disabled = false -- If "TreeSeed" is a script, its "Disabled", not "Enabled" wait(5) game.Workspace.TreeSeed.Disabled = true end
function startGame() while true do wait(1) if game.Players.NumPlayers == 0 then resetGame() break end -- If everyone leaves, it resets and stops the game until someone joins :) time = time - 1 msg.Text = "The God demands " ..coal.. " pieces of coal within " ..time.. " seconds!" if time == 0 or game.Workspace.Altar.CoalValue.Value >= coal then -- "or" because otherwise the round will keep going even if theres enough coal! godIsPleased() elseif time == 0 and game.Workspace.Altar.CoalValue < coal then godNotPleased() end -- Moved one end here from after the time = time -1.. The loop should end here, otherwise the loop will be infinite end end
-- The num players thing wouldnt work at all.. So lets make a loop to keep the game running while wait(1) do if game.Players.NumPlayers > 0 then -- If players "NumPlayer" is ovar 0.. startGame() end end
|
|
|
| Report Abuse |
|
|