Noahk
|
  |
| Joined: 14 Feb 2008 |
| Total Posts: 1460 |
|
|
| 23 Apr 2012 06:11 PM |
Well, if you don't steal my work, I have a script that, well, is pretty obvious in intent, but does not work and does not produce output.
Players = Game:GetService("Players") DominatorConnection = nil Indicator = game.Lighting.Indicator:clone()
function removeDominator(player) player.Dominator.Value = false player.TeamColor = BrickColor.new("Bright blue") DominatorConnection:disconnect() end
function makeDominator(player) player.Dominator.Value = true player.TeamColor = BrickColor.new("Bright yellow") Indicator.Parent = player.Character.Torso DominatorConnection = player.CharacterAdded:connect(function(character) character.Humanoid.MaxHealth = Players.NumPlayers * 100 character.Humanoid.Health = character.Humanoid.MaxHealth local BadgeService = Game:GetService("BadgeService") if not BadgeService:UserHasBadge(player.userId, 77823270) then Game:GetService("BadgeService"):AwardBadge(player.userId, 77823270) character.Humanoid.Died:connect(function() pcall(function() local killername = Players:findFirstChild(character.Humanoid.creator.Value) if Players:GetPlayerFromCharacter(character).TeamColor == BrickColor.new("Bright yellow") then makeDominator(killername) removeDominator(Players:GetPlayerFromCharacter(character)) local msg = Instance.new("Message",Workspace) msg.Text = player.Name.." has died or left, so "..killername.Name.." is the new Dominator!" wait(3) msg:Destroy() end end) end) end end) end Players.Changed:connect(function(property) if property == "NumPlayers" then makeDominator(Players:findFirstChild(character.Name)) character.Humanoid.MaxHealth = Players.NumPlayers * 100 character.Humanoid.Health = character.Humanoid.MaxHealth end end)
function onPlayerAdded(player) domValue = Instance.new("BoolValue",player) domValue.Name = "Dominator" wait(.5) if Players.NumPlayers == 1 then while true do if player.Character ~= nil then break end wait(.1) end makeDominator(player) end end
function onPlayerRemoving(player) if player.Dominator.Value then wait(3) playerz = game.Players:GetPlayers() randomplyr = playerz[math.random(1, #players)] makeDominator(randomplyr) end end
Players.PlayerAdded:connect(onPlayerAdded) Players.PlayerRemoving:connect(onPlayerRemoving) print("Hurrah, script works") |
|
|
| Report Abuse |
|
|
gamehero
|
  |
| Joined: 12 Jun 2007 |
| Total Posts: 1455 |
|
|
| 23 Apr 2012 09:21 PM |
I can't really debug your script easily from here. But I can give you some advice.
If their's no output, start spamming print() functions before and after the first 'if' statements and loops. Then run, and repeat the process until there's no output where there should be.
|
|
|
| Report Abuse |
|
|
|
| 23 Apr 2012 10:25 PM |
Didn't really read through the whole script, but I can tell you right now that :disconnect does not stop a currently running function. It only stops listening for an event.
Also, what might help is what part of it isn't working, such as "Oh, this part wont delete!" or "Oh, this part wont blink and follow me" or something along those lines. |
|
|
| Report Abuse |
|
|
Noahk
|
  |
| Joined: 14 Feb 2008 |
| Total Posts: 1460 |
|
|
| 24 Apr 2012 06:51 AM |
| Nobody's team is changed to bright yellow. |
|
|
| Report Abuse |
|
|
|
| 25 Apr 2012 10:26 PM |
| At the bottom, try "game.Players...". |
|
|
| Report Abuse |
|
|
thane1326
|
  |
| Joined: 08 Apr 2009 |
| Total Posts: 867 |
|
|
| 25 Apr 2012 10:31 PM |
| Yea, thats what I was thinking. |
|
|
| Report Abuse |
|
|
Noahk
|
  |
| Joined: 14 Feb 2008 |
| Total Posts: 1460 |
|
|
| 26 Apr 2012 08:16 AM |
Players = Game:GetService("Players")
It's at the top. I'll try it anyways. Also, there appears to be a problem occurring after the teams are changed- the message does not come up. EVerything else works fine. |
|
|
| Report Abuse |
|
|