- Code:
local ting = false
function Start()
if ting == false then
ting = true
_G.yellow = 0
local Point1 = Vector3.new(89, 26.6, 3)
local Point2 = Vector3.new(38, 26.6, 3)
function Move(TeamColor)
local plyrs = {}
for i,v in ipairs(game.Players:GetChildren())do
if(v.TeamColor == "Bright yellow")then
yellow = yellow + 1
if yellow == 2 then
if(pcall(function() assert(v.Character.Torso) end))then
table.insert(plyrs,v)
end
end
end
local rand1 = math.random(#plyrs)
local choice1 = plyrs[rand1]
table.remove(plyrs,rand1)
local choice2 = plyrs[math.random(#plyrs)]
local msg = Instance.new("Message")
msg.Parent = game.Workspace
msg.Text = "The game will now begin."
wait(2)
msg.Text = "The players are ... "..choice1.Character.Name.." and "..choice2.Character.Name.."."
wait(4)
msg.Text = "Get Ready!"
wait(3)
choice1.Character.Torso.CFrame = CFrame.new(Point1)
choice2.Character.Torso.CFrame = CFrame.new(Point2)
msg.Text = "GO!"
msg:Remove()
local Hintimer = Instance.new("Hint")
Hintimer.Parent = game.Workspace
_G.timer1 = 2
_G.timer2 = 0
_G.timer3 = 0
while true do
Hintimer.Text = timer3..":" ..timer2 ..timer1
wait(1)
while timer3 == 0 do
timer2 = timer2 - 1
wait(1)
end
while timer2 == 0 do
timer1 = timer1 -1
if timer1 == 0 then
Hintimer.Text = "GAME OVER!!!"
msg3 = Instance.new("Message")
msg3.Parent = game.Workspace
if choice1.leaderstats.Orbs.Value > choice2.leaderstats.Orbs.Value then
msg3.Text = string.upper(choice1.Character.Name.."wins!!!")
choice1.leaderstats.Wins.Value = choice1.leaderstats.Wins.Value + 1
msg3:Remove()
choice1.Character:BreakJoints()
choice2.Character:BreakJoints()
elseif choice2.leaderstats.Orbs.Value > choice1.leaderstats.Orbs.Value then
msg3.Text = string.upper(choice2.Character.Name.."wins!!!")
choice2.leaderstats.Wins.Value = choice2.leaderstats.Wins.Value + 1
msg3:Remove()
choice1.Character:BreakJoints()
choice2.Character:BreakJoints()
else
msg3.Text = "Tie!"
msg3:Remove()
end
end
end
end
end
if choice1.leaderstats.Orbs.Value == 200 then
choice1.leaderstats.Wins.Value = choice1.leaderstats.Wins.Value + 1
msg1 = Instance.new("Message")
msg1.Parent = game.Workspace
msg1.Text = string.upper(choice1.Character.Name.."wins!!!")
choice1.Character:BreakJoints()
choice2.Character:BreakJoints()
elseif choice2.leaderstats.Orbs.Value == 200 then
choice2.leaderstats.Wins.Value = choice2.leaderstats.Wins.Value + 1
msg2 = Instance.new("Message")
msg2.Parent = game.Workspace
msg2.Text = string.upper(choice2.Character.Name.."wins!!!")
choice1.Character:BreakJoints()
choice2.Character:BreakJoints()
ting = false
end
end
end
end
while ting == true do
Start()
wait()
end
4 posters
Errors and no output
iMathRandom- Mod
- Posts : 66
Join date : 2009-06-21
Location : Ohio
- Post n°1
Errors and no output
Earth- Admin
- Posts : 402
Join date : 2009-06-18
Location : According to my IP address: Topeka, Kansas.
- Post n°2
Re: Errors and no output
Did you make that?
Why do you need global timers and pcall?
Why do you need global timers and pcall?
Jfeather- Admin
- Posts : 232
Join date : 2009-06-18
Location : This Forum. Duh.
- Post n°3
Re: Errors and no output
It looks like a game-running script.
iMathRandom- Mod
- Posts : 66
Join date : 2009-06-21
Location : Ohio
- Post n°4
Re: Errors and no output
I had no Idea what "_G." was. If that is what the problem is, can you fix it?
Jfeather- Admin
- Posts : 232
Join date : 2009-06-18
Location : This Forum. Duh.
- Post n°5
Re: Errors and no output
....That's why I always make my own scripts. It looks like the variable _G was never assigned in that script, ruining the whole thing...?
What were you trying to make, anyway?
What were you trying to make, anyway?
Earth- Admin
- Posts : 402
Join date : 2009-06-18
Location : According to my IP address: Topeka, Kansas.
- Post n°6
Re: Errors and no output
Re write it without pcall and _G
Then see if it works.
Then see if it works.
iMathRandom- Mod
- Posts : 66
Join date : 2009-06-21
Location : Ohio
- Post n°7
Re: Errors and no output
@ Jf,
I did make it myself and Have you ever played Kingdom Hearts II
I did make it myself and Have you ever played Kingdom Hearts II
Jfeather- Admin
- Posts : 232
Join date : 2009-06-18
Location : This Forum. Duh.
- Post n°8
Re: Errors and no output
No, I have not.
Not to be offencive, but if you made the script, you should know what everything inside it is, and what it does. If you don't know what something does/is, you might as well remove it. This doesn't mean the script will still work, though
Not to be offencive, but if you made the script, you should know what everything inside it is, and what it does. If you don't know what something does/is, you might as well remove it. This doesn't mean the script will still work, though
Earth- Admin
- Posts : 402
Join date : 2009-06-18
Location : According to my IP address: Topeka, Kansas.
- Post n°9
Re: Errors and no output
Don't over complicate things.
Only Meelo can do that.
Only Meelo can do that.
iMathRandom- Mod
- Posts : 66
Join date : 2009-06-21
Location : Ohio
- Post n°10
Re: Errors and no output
skip to 2:00
I was asked to script that for a firend, I was getting help on roblox's forum when ppl told me to use _G. for teams. I didn't know it wouldn't work with everything . Meelo did the pcall part.
EDIT:
I've redid it
I was asked to script that for a firend, I was getting help on roblox's forum when ppl told me to use _G. for teams. I didn't know it wouldn't work with everything . Meelo did the pcall part.
EDIT:
I've redid it
- Code:
function Start()
_G.yellow = 0
local Point1 = Vector3.new(89, 26.6, 3)
local Point2 = Vector3.new(38, 26.6, 3)
function Move(TeamColor)
local plyrs = {}
for i,v in ipairs(game.Players:GetChildren())do
if(v.TeamColor == "Bright yellow")then
yellow = yellow + 1
if yellow == 2 then
if(pcall(function() assert(v.Character.Torso) end))then
table.insert(plyrs,v)
end
end
end
local rand1 = math.random(#plyrs)
local choice1 = plyrs[rand1]
table.remove(plyrs,rand1)
local choice2 = plyrs[math.random(#plyrs)]
local msg = Instance.new("Message")
msg.Parent = game.Workspace
msg.Text = "The game will now begin."
wait(2)
msg.Text = "The players are ... "..choice1.Character.Name.." and "..choice2.Character.Name.."."
wait(4)
msg.Text = "Get Ready!"
wait(3)
choice1.Character.Torso.CFrame = CFrame.new(Point1)
choice2.Character.Torso.CFrame = CFrame.new(Point2)
msg.Text = "GO!"
msg:Remove()
local hint = Instance.new("Hint")
hint.Parent = game.Workspace
local set.Name = hint.Text
set.Name = "Get Ready!"
wait(5)
set.Name = "BEGGIN!!!"
wait(1)
set.Name = "2:00"
wait(1)
set.Name = "1:59"
wait(1)
set.Name = "1:58"
wait(1)
set.Name = "1:57"
wait(1)
set.Name = "1:56"
wait(1)
set.Name = "1:55"
wait(1)
set.Name = "1:54"
wait(1)
set.Name = "1:53"
wait(1)
set.Name = "1:52"
wait(1)
set.Name = "1:51"
wait(1)
set.Name = "1:50"
wait(1)
set.Name = "1:49"
wait(1)
set.Name = "1:48"
wait(1)
set.Name = "1:47"
wait(1)
set.Name = "1:46"
wait(1)
set.Name = "1:45"
wait(1)
set.Name = "1:44"
wait(1)
set.Name = "1:43"
wait(1)
set.Name = "1:42"
wait(1)
set.Name = "1:41"
wait(1)
set.Name = "1:40"
wait(1)
set.Name = "1:39"
wait(1)
set.Name = "1:38"
wait(1)
set.Name = "1:37"
wait(1)
set.Name = "1:36"
wait(1)
set.Name = "1:35"
wait(1)
set.Name = "1:34"
wait(1)
set.Name = "1:33"
wait(1)
set.Name = "1:32"
wait(1)
set.Name = "1:31"
wait(1)
set.Name = "1:30"
wait(1)
set.Name = "1:29"
wait(1)
set.Name = "1:28"
wait(1)
set.Name = "1:27"
wait(1)
set.Name = "1:26"
wait(1)
set.Name = "1:25"
wait(1)
set.Name = "1:24"
wait(1)
set.Name = "1:23"
wait(1)
set.Name = "1:22"
wait(1)
set.Name = "1:21"
wait(1)
set.Name = "1:20"
wait(1)
set.Name = "1:19"
wait(1)
set.Name = "1:18"
wait(1)
set.Name = "1:17"
wait(1)
set.Name = "1:16"
wait(1)
set.Name = "1:15"
wait(1)
set.Name = "1:14"
wait(1)
set.Name = "1:13"
wait(1)
set.Name = "1:12"
wait(1)
set.Name = "1:11"
wait(1)
set.Name = "1:10"
wait(1)
set.Name = "1:09"
wait(1)
set.Name = "1:08"
wait(1)
set.Name = "1:07"
wait(1)
set.Name = "1:06"
wait(1)
set.Name = "1:05"
wait(1)
set.Name = "1:04"
wait(1)
set.Name = "1:03"
wait(1)
set.Name = "1:02"
wait(1)
set.Name = "1:01"
wait(1)
set.Name = "1:00"
wait(1)
set.Name = "0:59"
wait(1)
set.Name = "0:58"
wait(1)
set.Name = "0:57"
wait(1)
set.Name = "0:56"
wait(1)
set.Name = "0:55"
wait(1)
set.Name = "0:54"
wait(1)
set.Name = "0:53"
wait(1)
set.Name = "0:52"
wait(1)
set.Name = "0:51"
wait(1)
set.Name = "0:50"
wait(1)
set.Name = "0:49"
wait(1)
set.Name = "0:48"
wait(1)
set.Name = "0:47"
wait(1)
set.Name = "0:46"
wait(1)
set.Name = "0:45"
wait(1)
set.Name = "0:44"
wait(1)
set.Name = "0:43"
wait(1)
set.Name = "0:42"
wait(1)
set.Name = "0:41"
wait(1)
set.Name = "0:40"
wait(1)
set.Name = "0:39"
wait(1)
set.Name = "0:38"
wait(1)
set.Name = "0:37"
wait(1)
set.Name = "0:36"
wait(1)
set.Name = "0:35"
wait(1)
set.Name = "0:34"
wait(1)
set.Name = "0:33"
wait(1)
set.Name = "0:32"
wait(1)
set.Name = "0:31"
wait(1)
set.Name = "0:30"
wait(1)
set.Name = "0:29"
wait(1)
set.Name = "0:28"
wait(1)
set.Name = "0:27"
wait(1)
set.Name = "0:26"
wait(1)
set.Name = "0:25"
wait(1)
set.Name = "0:24"
wait(1)
set.Name = "0:23"
wait(1)
set.Name = "0:22"
wait(1)
set.Name = "0:21"
wait(1)
set.Name = "0:20"
wait(1)
set.Name = "0:19"
wait(1)
set.Name = "0:18"
wait(1)
set.Name = "0:17"
wait(1)
set.Name = "0:16"
wait(1)
set.Name = "0:15"
wait(1)
set.Name = "0:14"
wait(1)
set.Name = "0:13"
wait(1)
set.Name = "0:12"
wait(1)
set.Name = "0:11"
wait(1)
set.Name = "0:10"
wait(1)
set.Name = "0:09"
wait(1)
set.Name = "0:08"
wait(1)
set.Name = "0:07"
wait(1)
set.Name = "0:06"
wait(1)
set.Name = "0:05"
wait(1)
set.Name = "0:04"
wait(1)
set.Name = "0:03"
wait(1)
set.Name = "0:02"
wait(1)
set.Name = "0:01"
wait(1)
set.Name = "END OF MATCH!"
wait(2)
msg3 = Instance.new("Message")
msg3.Parent = game.Workspace
end
if choice1.leaderstats.Orbs.Value > choice2.leaderstats.Orbs.Value then
msg3.Text = string.upper(choice1.Character.Name.."wins!!!")
choice1.leaderstats.Wins.Value = choice1.leaderstats.Wins.Value + 1
msg3:Remove()
choice1.Character:BreakJoints()
choice2.Character:BreakJoints()
elseif choice2.leaderstats.Orbs.Value > choice1.leaderstats.Orbs.Value then
msg3.Text = string.upper(choice2.Character.Name.."wins!!!")
choice2.leaderstats.Wins.Value = choice2.leaderstats.Wins.Value + 1
msg3:Remove()
choice1.Character:BreakJoints()
choice2.Character:BreakJoints()
else
msg3.Text = "Tie!"
msg3:Remove()
end
if choice1.leaderstats.Orbs.Value == 200 then
choice1.leaderstats.Wins.Value = choice1.leaderstats.Wins.Value + 1
msg1 = Instance.new("Message")
msg1.Parent = game.Workspace
msg1.Text = string.upper(choice1.Character.Name.."wins!!!")
choice1.Character:BreakJoints()
choice2.Character:BreakJoints()
elseif choice2.leaderstats.Orbs.Value == 200 then
choice2.leaderstats.Wins.Value = choice2.leaderstats.Wins.Value + 1
msg2 = Instance.new("Message")
msg2.Parent = game.Workspace
msg2.Text = string.upper(choice2.Character.Name.."wins!!!")
choice1.Character:BreakJoints()
choice2.Character:BreakJoints()
end
end
end
iMathRandom- Mod
- Posts : 66
Join date : 2009-06-21
Location : Ohio
- Post n°11
Re: Errors and no output
Theres a script that goes with it that Im not getting an output on
http://www.roblox.com/Forum/ShowPost.aspx?PostID=10092949#10127212
http://www.roblox.com/Forum/ShowPost.aspx?PostID=10092949#10127212
Jfeather- Admin
- Posts : 232
Join date : 2009-06-18
Location : This Forum. Duh.
- Post n°12
Re: Errors and no output
NOTE: I'm talking about the script on post 10.
Hmm.. first off, You don't say what _G is, but you act like you're finding something within _G.
Right here:
If you're using a variable inside the script, just use G = 0. If you're not, i.e. you're finding something outside the script, you're going to need to tell the script what you're looking for (_G = game.Workspace.whatever.whatever), THEN assign it's value.
Also, am I missing something, or are you missing the end for the the Start() function?
Also, You start the whole script with a function. Is there anything inside the code that isn't inside any function? If not, at the very very end, after everything, add
I might be totally wrong, but that's all I can think of... hopefully it helps somehow.
Hmm.. first off, You don't say what _G is, but you act like you're finding something within _G.
Right here:
- Code:
_G.yellow = 0
If you're using a variable inside the script, just use G = 0. If you're not, i.e. you're finding something outside the script, you're going to need to tell the script what you're looking for (_G = game.Workspace.whatever.whatever), THEN assign it's value.
Also, am I missing something, or are you missing the end for the the Start() function?
Also, You start the whole script with a function. Is there anything inside the code that isn't inside any function? If not, at the very very end, after everything, add
- Code:
Start() OR MovePlayers(Teamcolorhere)
I might be totally wrong, but that's all I can think of... hopefully it helps somehow.
Last edited by Jfeather on Thu Jun 25, 2009 7:49 pm; edited 2 times in total
Earth- Admin
- Posts : 402
Join date : 2009-06-18
Location : According to my IP address: Topeka, Kansas.
- Post n°13
Re: Errors and no output
Totally wrong about _G
_G.yellow = 1
is valid.
_G.yellow = 1
is valid.
Jfeather- Admin
- Posts : 232
Join date : 2009-06-18
Location : This Forum. Duh.
- Post n°14
Re: Errors and no output
What is _G? I think I'm over my head here. Anyway, I fixed my previous post.
Earth- Admin
- Posts : 402
Join date : 2009-06-18
Location : According to my IP address: Topeka, Kansas.
- Post n°15
Re: Errors and no output
global stuff
EG in one script
[[
_G.EPIC = "Earth100"
]]
in another...
[[
wait() -- needs to store global value
print(EPIC)
]]
output: Earth100
EG in one script
[[
_G.EPIC = "Earth100"
]]
in another...
[[
wait() -- needs to store global value
print(EPIC)
]]
output: Earth100
Jfeather- Admin
- Posts : 232
Join date : 2009-06-18
Location : This Forum. Duh.
- Post n°16
Re: Errors and no output
Oh. I was totally unaware of that feature... that could be pretty useful.
Earth- Admin
- Posts : 402
Join date : 2009-06-18
Location : According to my IP address: Topeka, Kansas.
- Post n°17
Re: Errors and no output
But it causes a bit more lag then normal
But if you redefine it
local Epic = Epic
then that fixes it
But if you redefine it
local Epic = Epic
then that fixes it
iMathRandom- Mod
- Posts : 66
Join date : 2009-06-21
Location : Ohio
- Post n°18
Re: Errors and no output
I'll look over it more carfully.
Kaleb12- New
- Posts : 10
Join date : 2009-08-07
- Post n°19
Re: Errors and no output
Thanks Earth. Now I don't have to find out what Globals are from the wiki.
|
|