|
| 27 Jan 2012 06:08 PM |
What these scripts are supposed to do and what they are: These are both linked to 2 buttons, that when pressed, are supposed to add one point to the team of the person pressed, if that person is on a certain team, then display 2 messages, one saying that a team won a round, and then a message with a score of both teams.
What's wrong: It works fine the 1st time I take my character to the button and press it. The 2nd time, I get the "Not part of the team" message in the ouput. (As in, the if requirements were not passed the 2nd time) Mind you, I'm doing this with the same character the 2nd time I go back to the button.
------------------------------Tournament buttons------------------------------
db = false function jalepenopoint(hit) print("Function started to run") if hit.Parent:findFirstChild("Humanoid") and game.Players:playerFromCharacter(hit.Parent).TeamColor==BrickColor.new("Bright blue") and shared.tournamentactivated == true and db == false then --change this to the teamcolor of the team you want to be able to open this door db = true hit.Parent:BreakJoints() --Kills humanoid local h = Instance.new("Message") --Makes message h.Parent = Workspace --Puts message where all can see h.Text = "The Jalepenos have won the round!" --Changes message words shared.c = shared.c + 1 --Changes score wait(5) h:Destroy() local l = Instance.new("Message") l.Parent = Workspace l.Text = "The Bagels current score is now " ..shared.e.. " and the Jalepenos is " ..shared.c.. "!" wait(7) l:Destroy() db = false else print("Not part of the team") end end
Workspace.TournamentSetup.jalepenowin.Touched:connect(jalepenopoint)
dba = false function bagelpoint(hit) print("Function started to run") if hit.Parent:findFirstChild("Humanoid") and game.Players:playerFromCharacter(hit.Parent).TeamColor==BrickColor.new("Bright blue") and shared.tournamentactivated == true and dba == false then --change this to the teamcolor of the team you want to be able to open this door dba = true hit.Parent:BreakJoints() --Kills humanoid local h = Instance.new("Message") --Makes message h.Parent = Workspace --Puts message where all can see h.Text = "The Jalepenos have won the round!" --Changes message words shared.c = shared.c + 1 --Changes score wait(5) h:Destroy() local l = Instance.new("Message") l.Parent = Workspace l.Text = "The Bagels current score is now " ..shared.e.. " and the Jalepenos is " ..shared.c.. "!" wait(7) l:Destroy() dba = false else print("Not part of the team") end end
Workspace.TournamentSetup.bagelwin.Touched:connect(bagelpoint) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 27 Jan 2012 07:00 PM |
| What is the players TeamColor the first time? |
|
|
| Report Abuse |
|
|
|
| 27 Jan 2012 07:04 PM |
Bright blue. HE is also Bright blue the 2nd time. |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Jan 2012 08:28 PM |
| Bump. Can't anyone fix this sript? D: |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Jan 2012 09:10 PM |
When you use the method ":Destroy()" that disconnects everything. That means the ".Touched:connect()" is done.
Just use ":Remove()" and it should be fixed. If not, debug it with the help of the wonderful Output. |
|
|
| Report Abuse |
|
|
|
| 27 Jan 2012 10:07 PM |
@soccer "We're sorry, the script you have been trying to fix has not been in fact, fixed. Please try another method. Thank you" |
|
|
| Report Abuse |
|
|
|
| 27 Jan 2012 10:25 PM |
If it helps anyone (It probably won't it's 59 lines of code), but this script interacts with the one I posted above.
math.randomseed(tick()) -------------------------Tournament Setup------------------------------ shared.tournamentactivated = false shared.teamroundactivated = false debounce = false function Click() print("Function started") --Did not print<--Fixed if debounce == false and shared.teamroundactivated == false and shared.tournamentactivated == false then shared.tournamentactivated = true debounce = true for _, ply in pairs(game.Players:GetChildren()) do if ply and ply.Character then if ply.TeamColor == BrickColor.new("Bright blue") then ply.Character:MoveTo(Vector3.new(math.random(21, 49), 947, math.random( -275, -265))) else ply.Character:MoveTo(Vector3.new(math.random(379, 393), 947, math.random(-61, -45))) end end end local h = Instance.new("Message") h.Parent = Workspace h.Text = "The tournament has been activated" lol = true shared.e = 0 shared.c = 0 wait(5) h:Destroy() debounce = false while lol == true do wait(2) if shared.e == 8 then shared.tournamentactivated = false lol = false shared.e = 0 shared.c = 0 local t = Instance.new("Message") t.Text = "The bagels have won the tournament!" wait(10) t:Destroy() elseif shared.c == 8 then lol = false shared.tournamentactivated = false shared.e = 0 shared.c = 0 local z = Instance.new("Message") z.Text = "The Jalepenos have won the tournament" wait(10) z:Destroy() end end elseif shared.tournamentactivated == true or shared.teamroundactivated == true then script.Parent.Parent.Active.Visible = true wait(7) script.Parent.Parent.Active.Visible = false end end script.Parent.MouseButton1Down:connect(Click)
|
|
|
| Report Abuse |
|
|
|
| 27 Jan 2012 10:43 PM |
| Nevar gonna get fixed, but I bother bumpin' cuz I hope. Because hope is all we have. |
|
|
| Report Abuse |
|
|
|
| 27 Jan 2012 11:06 PM |
| The 8th bummmmmmp. Yaaaaaa. |
|
|
| Report Abuse |
|
|
|
| 27 Jan 2012 11:16 PM |
82 views. More than 50% of you are not trying O:< That makes me sad :( |
|
|
| Report Abuse |
|
|
| |
|
| |
|