|
| 30 Jan 2014 06:29 PM |
I know there's absolutely no syntax errors. So, I have this script that, when you say "duel:" then some person's name, it teleports you and your opponent to a dueling arena and puts both your names in a table. Later in the script, I have an event, a Humanoid.Died event.
duelers[1].Character.Humanoid.Died:connect(function()
The event doesn't run when duelers[1] dies. I even made a script to edit a message in-game if duelers[1] and duelers[2] have a Humanoid in their character, and the message changes. Why doesn't the event run?
Outfoxing Foxes |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2014 06:34 PM |
B-b-b-b-b-b-b-b-bump
Outfoxing Foxes |
|
|
| Report Abuse |
|
|
Azureous
|
  |
| Joined: 29 Jan 2012 |
| Total Posts: 25287 |
|
|
| 30 Jan 2014 06:37 PM |
A string doesn't have a Humanoid, therefore the Died event fails.
Insert the player rather than the string. |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2014 06:39 PM |
Agree with Azureous. Names are strings, not the actual player. Store the actual player instances in the table instead. |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2014 06:39 PM |
That's what I did, actually.
Outfoxing Foxes |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2014 06:41 PM |
Sorry, I wrote my first paragraph weird. Yes, I meant I put their player instances in a table, I didn't put their names in a table o3o Sorry for the confusion.
*whistles*
Floodcheck has really been getting to me today.
*whistles*
Outfoxing Foxes |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 30 Jan 2014 06:59 PM |
bee you em pee
Outfoxing Foxes |
|
|
| Report Abuse |
|
|
| |
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 31 Jan 2014 04:03 PM |
| Could you just post that section of code .-. |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2014 07:54 PM |
There are lots of parts of my script that have to do with the table, so I'd have to put the whole thing, and that's pretty much like putting my game on the forum for anyone to take.
Outfoxing Foxes |
|
|
| Report Abuse |
|
|
Vuva
|
  |
| Joined: 22 Jan 2010 |
| Total Posts: 1102 |
|
|
| 31 Jan 2014 08:16 PM |
| The only explanation I can think of then is that dueler[1] and/or dueler[2] are getting changed to something else and you don't realise it. Did you try adding something like "print(dueler[1])" right before the connection line and made sure that it was userdata(object) and the correct object? |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2014 04:48 PM |
The while loop maybe halfway through the script is what I was using to check. There's a message in Workspace that says "blah" after I start the server, then once I say "duel:dj" (dj is the alt I'm bringing to the game so I can test it), the message changes to "dooo" then "waffles" then "dooo" then "waffles" and so on. This shows that both the players do still exist and that they do have Humanoids.
duelers = {} a = false b = false game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(text) if script.Dueling.Value == false then for _, v in pairs(game.Players:GetChildren()) do if text:sub(1,4) == "duel" then if text:find(":") then uncaps = v.Name:lower() thing = text:sub(text:find(":")+1) if thing:lower() == uncaps:sub(1, thing:len()) then if game.Players:FindFirstChild(v.Name) then player1 = game.Players:FindFirstChild(v.Name) table.insert(duelers, player1) table.insert(duelers, player) player1.TeamColor = BrickColor.new("Bright violet") player.TeamColor = BrickColor.new("Lavender") player1:LoadCharacter() player:LoadCharacter() script.Dueling.Value = true n1 = Instance.new("NumberValue", player1) n1.Name = "Wins" n2 = Instance.new("NumberValue", player2) n2.Name = "Wins" hint = Instance.new("Hint", game.Workspace) hint.Text = player1.Name.." vs. "..player.Name.." in 3" wait(1) hint.Text = "2" wait(1) hint.Text = "1" wait(1) hint.Text = "GO!" wait(1) hint:remove() end end end end end end end) end)
while true do if not game.Workspace:FindFirstChild("Message") then mess = Instance.new("Message", game.Workspace) mess.Text = "blah" end wait(0.1) if duelers[1] then q = true if q == true then mess.Text = "dooo" if duelers[1].Character:FindFirstChild("Humanoid") then hum1 = duelers[1]:FindFirstChild("Humanoid") mess.Text = "yaaa" else mess.Text = "They player doesn't seem to have a Humanoid." end a = true wait(1) if duelers[2] then hum2 = duelers[2]:FindFirstChild("Humanoid") mess.Text = "waffles" b = true end end end end duelers[1].Died:connect(function() messa = Instance.new("Message", game.Workspace) messa.Text = "BLAAAAH" if a == true and b == true then wait(1) if duelers[2].Health > 0 then duelers[2].Wins.Value = duelers[2].Wins.Value + 1 if duelers[2].Wins.Value >= 5 and duelers[2].Wins.Value > duelers[1].Wins.Value + 1 then hint = Instance.new("Hint", game.Workspace) hint.Text = duelers[2].Name.." has won! Score: "..tostring(duelers[2].Wins.Value.."-"..tostring(duelers[1].Wins.Value)) script.Dueling.Value = false table.remove(2) table.remove(1) a = false b = false else hinta = Instance.new("Hint", game.Workspace) hinta.Text = duelers[2].Name.." got the most recent score. Score: "..tostring(duelers[2].Wins.Value.."-"..tostring(duelers[1].Wins.Value)) wait(1) hinta:remove() end else hinta = Instance.new("Hint", game.Workspace) hinta.Text = "They tied." wait(1) hinta:remove() end end end) duelers[2].Died:connect(function() hintq = Instance.new("Hint", game.Workspace) hintq.Text = "Dueler2 died." wait(1) hintq:remove() if a == true and b == true then wait(1) if duelers[1].Character.Humanoid.Health > 0 then duelers[1].Wins.Value = duelers[2].Wins.Value + 1 if duelers[1].Wins.Value >= 5 and duelers[1].Wins.Value > duelers[2].Wins.Value + 1 then hinta = Instance.new("Hint", game.Workspace) hinta.Text = duelers[1].Name.." has won! Score: "..tostring(duelers[1].Wins.Value.."-"..tostring(duelers[2].Wins.Value)) script.Dueling.Value = false a = false b = false table.remove(2) table.remove(1) wait(1) hinta:remove() else hinta = Instance.new("Hint", game.Workspace) hinta.Text = duelers[1].Name.." got the most recent score. Score: "..tostring(duelers[1].Wins.Value.."-"..tostring(duelers[2].Wins.Value)) wait(1) hinta:remove() end else hinta = Instance.new("Hint", game.Workspace) hinta.Text = "They tied." wait(1) hinta:remove() end end end)
Outfoxing Foxes |
|
|
| Report Abuse |
|
|
| |
|
|
| 01 Feb 2014 05:02 PM |
Not sure if the script is too intimidating or no one knows what the problem is.
Outfoxing Foxes |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2014 05:16 PM |
buuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuump
Outfoxing Foxes |
|
|
| Report Abuse |
|
|
getkoed
|
  |
| Joined: 18 Feb 2010 |
| Total Posts: 2298 |
|
|
| 01 Feb 2014 05:19 PM |
DERP DERP DERP
you put the never ending while loop in front of the event therefore it will never fire swap them. :dddddd |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2014 05:40 PM |
I swapped them. This time, the while loop never runs, and the event still never fires.
Outfoxing Foxes |
|
|
| Report Abuse |
|
|
getkoed
|
  |
| Joined: 18 Feb 2010 |
| Total Posts: 2298 |
|
|
| 01 Feb 2014 05:43 PM |
Try printing a and b before checking if they're both true. Perhaps they are false. :d
time for me to go at this odd hour good luck
I'LL BE BACK |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2014 05:45 PM |
Well, it never inserts the message that's supposed to be inserted when the player dies no matter what. And all right. See ya.
Outfoxing Foxes |
|
|
| Report Abuse |
|
|
Azureous
|
  |
| Joined: 29 Jan 2012 |
| Total Posts: 25287 |
|
|
| 01 Feb 2014 05:46 PM |
pcall(function() --code end)
--use protected call to determine errors :) |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2014 05:56 PM |
The game can't be tested in Start Server/Start Player mode, because it requires chat, which can't be used in that mode. And I don't think I can see the errors in pcall when I'm just in Play mode. I'm gonna go for maybe 25 minutes, I'll be back.
Outfoxing Foxes |
|
|
| Report Abuse |
|
|
| |
|
|
| 01 Feb 2014 09:20 PM |
I have a feeling that this bump...could be the bump to a good solution.
Outfoxing Foxes |
|
|
| Report Abuse |
|
|