Noahk
|
  |
| Joined: 14 Feb 2008 |
| Total Posts: 1460 |
|
|
| 23 Jun 2012 11:22 AM |
Me and duckunited158 have been working on this. It just, doesn't work. Any help???
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") local BadgeService = Game:GetService("BadgeService") game:GetService("BadgeService"):AwardBadge(player.userId, 77823270) wait(3) Indicator.Parent = player.Character.Torso player.Character.Humanoid.MaxHealth = Players.NumPlayers * 100 player.Character.Humanoid.Health = character.Humanoid.MaxHealth msg = Instance.new("Message") print''msg' assigned to new message' msg.Parent = game.Workspace print'parent set for message' msg.Text = "The Dominator has died or left, so "..player.Name.." is the new Dominator!" print'message customized' wait(3) print'wait succeeded' msg:Remove() end ------------------------------------------------------------------------- game.Players.PlayerAdded:connect(function(newPlayer) while true do if newPlayer.Character == nil then wait(.1) end end newPlayer.Character.Humanoid.Died:connect(function() local killername = game.Players:findFirstChild(newPlayer.Character.Humanoid.creator.Value.Name) if killername == nil then return end print 'killer found' if game.Players:GetPlayerFromCharacter(character).TeamColor == BrickColor.new("Bright yellow") then print 'dominator death detected' ---------------------------------------------------------------------- removeDominator(Players:findFirstChild(character.Name)) print'old dom removed' makeDominator(killername) print'newdom' print'Message removed. Script works.' end end) end)
function onPlayerAdded(player) domValue = Instance.new("BoolValue",player) domValue.Name = "Dominator" wait(.5) if game.Players.NumPlayers == 1 then makeDominator(player) end end
function onPlayerRemoving(player) if player.Dominator.Value then wait(3) playerz = game.Players:GetPlayers() randomplyr = playerz[math.random(1, #game.Players.NumPlayers)] makeDominator(randomplyr) end end
game.Players.PlayerAdded:connect(onPlayerAdded) game.Players.PlayerRemoving:connect(onPlayerRemoving) print("Hurrah, script works")
|
|
|
| Report Abuse |
|
|
Noahk
|
  |
| Joined: 14 Feb 2008 |
| Total Posts: 1460 |
|
| |
|
gamehero
|
  |
| Joined: 12 Jun 2007 |
| Total Posts: 1455 |
|
|
| 23 Jun 2012 12:00 PM |
Wow this script is a mess... I only got to about as far as I could until I had no idea what the script was supposed to do. You may be able to figure it out on your own at this point. I have no idea.
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") local BadgeService = Game:GetService("BadgeService") game:GetService("BadgeService"):AwardBadge(player.userId, 77823270) wait(3) Indicator.Parent = player.Character.Torso player.Character.Humanoid.MaxHealth = game.Players.NumPlayers * 100 player.Character.Humanoid.Health = player.Character.Humanoid.MaxHealth msg = Instance.new("Message") print"'msg' assigned to new message" msg.Parent = game.Workspace print'parent set for message' msg.Text = "The Dominator has died or left, so "..player.Name.." is the new Dominator!" print'message customized' wait(3) print'wait succeeded' msg:Remove() end ------------------------------------------------------------------------- game.Players.PlayerAdded:connect(function(newPlayer) while newPlayer.Character == nil do wait(.1) end
newPlayer.Character.Humanoid.Died:connect(function() local killername = game.Players:findFirstChild(newPlayer.Character.Humanoid.creator.Value.Name) if killername == nil then return end print 'killer found' if game.Players:GetPlayerFromCharacter(character).TeamColor == BrickColor.new("Bright yellow") then print 'dominator death detected' ---------------------------------------------------------------------- removeDominator(game.Players:findFirstChild(character.Name)) print'old dom removed' makeDominator(killername) print'newdom' print'Message removed. Script works.' end end) end)
function onPlayerAdded(player) domValue = Instance.new("BoolValue",player) domValue.Name = "Dominator" wait(.5) if game.Players.NumPlayers == 1 then makeDominator(player) end end
function onPlayerRemoving(player) if player.Dominator.Value then wait(3) playerz = game.Players:GetPlayers() randomplyr = playerz[math.random(1, #game.Players.NumPlayers)] makeDominator(randomplyr) end end
game.Players.PlayerAdded:connect(onPlayerAdded) game.Players.PlayerRemoving:connect(onPlayerRemoving) print("Hurrah, script works")
|
|
|
| Report Abuse |
|
|
|
| 23 Jun 2012 12:02 PM |
| String concentating is a mess, get all the prints() out of htere. |
|
|
| Report Abuse |
|
|
gamehero
|
  |
| Joined: 12 Jun 2007 |
| Total Posts: 1455 |
|
|
| 23 Jun 2012 12:17 PM |
It's not the print messages that are a problem. It helped me when I was testing the script in studio. I knew where there was a problem, and where there wasn't.
The real mess is the nil variables and incorrectly called variables that I have to fix and debug. I don't want to make the script do something its not supposed to do when I think that's correct. =P |
|
|
| Report Abuse |
|
|
Noahk
|
  |
| Joined: 14 Feb 2008 |
| Total Posts: 1460 |
|
|
| 23 Jun 2012 12:20 PM |
| Thanks for all the help guys, can you point out the variables and doo-dahs that I have made errors writing? |
|
|
| Report Abuse |
|
|
gamehero
|
  |
| Joined: 12 Jun 2007 |
| Total Posts: 1455 |
|
|
| 23 Jun 2012 12:38 PM |
Oh wait.. It wasn't as a pain to fix as I thought. Just a warning though, there may be a fluke somewhere in the code that I missed.
print("Start") DominatorConnection = nil Indicator = game.Lighting.Indicator:clone()
function removeDominator(player) player.Dominator.Value = false player.TeamColor = BrickColor.new("Bright blue") --DominatorConnection:disconnect() -- < < Errors here... is it needed? end
function makeDominator(player) player.Dominator.Value = true player.TeamColor = BrickColor.new("Bright yellow") local BadgeService = Game:GetService("BadgeService") game:GetService("BadgeService"):AwardBadge(player.userId, 77823270) wait(3) Indicator.Parent = player.Character.Torso player.Character.Humanoid.MaxHealth = game.Players.NumPlayers * 100 player.Character.Humanoid.Health = player.Character.Humanoid.MaxHealth msg = Instance.new("Message") print"'msg' assigned to new message" msg.Parent = game.Workspace print'parent set for message' msg.Text = "The Dominator has died or left, so "..player.Name.." is the new Dominator!" print'message customized' wait(3) print'wait succeeded' msg:Remove() end -------------------------------------------------------------------------
function onPlayerAdded(player) domValue = Instance.new("BoolValue",player) domValue.Name = "Dominator" wait(.5) if game.Players.NumPlayers == 1 then makeDominator(player) end
player.CharacterAdded:connect(function(character) character.Humanoid.Died:connect(function() local killer = game.Players:findFirstChild(character.Humanoid.creator.Value) if killer == nil then return end print 'killer found' if game.Players:GetPlayerFromCharacter(character).TeamColor == BrickColor.new("Bright yellow") then print 'dominator death detected' ---------------------------------------------------------------------- removeDominator(game.Players:findFirstChild(character.Name)) print'old dom removed' makeDominator(killer) print'newdom' print'Message removed. Script works.' end end) end)
end
function onPlayerRemoving(player) if player.Dominator.Value then wait(3) playerz = game.Players:GetPlayers() randomplyr = playerz[math.random(1, #game.Players.NumPlayers)] makeDominator(randomplyr) end end
game.Players.PlayerAdded:connect(onPlayerAdded) game.Players.PlayerRemoving:connect(onPlayerRemoving) print("Hurrah, script works")
|
|
|
| Report Abuse |
|
|
Noahk
|
  |
| Joined: 14 Feb 2008 |
| Total Posts: 1460 |
|
|
| 24 Jun 2012 04:43 PM |
I'm testing the code now.
Hey Gamehero, are you the one that made the rocket ship a long time ago? Forgive me if I'm wrong, but I loved that place. |
|
|
| Report Abuse |
|
|
Noahk
|
  |
| Joined: 14 Feb 2008 |
| Total Posts: 1460 |
|
|
| 25 Jun 2012 09:41 AM |
| Anyways, I tested the code out. It seems not to work. Part of my problem is that I cant run server mode, so I cant see output. |
|
|
| Report Abuse |
|
|
Noahk
|
  |
| Joined: 14 Feb 2008 |
| Total Posts: 1460 |
|
|
| 26 Jun 2012 09:22 AM |
| Still has some problems :/ |
|
|
| Report Abuse |
|
|
huner2
|
  |
| Joined: 27 Apr 2008 |
| Total Posts: 1681 |
|
|
| 26 Jun 2012 09:54 AM |
| You can see the output in Server Mode by going to ROBLOX's models and taking thier "Server Error Montering Script" and inserting it in your place in studio mode,and then making sure you are on the value that lets you see the Gui. |
|
|
| Report Abuse |
|
|
Noahk
|
  |
| Joined: 14 Feb 2008 |
| Total Posts: 1460 |
|
|
| 26 Jun 2012 10:02 AM |
| My computer cannot handle Server Mode, my computer crashes. |
|
|
| Report Abuse |
|
|
gamehero
|
  |
| Joined: 12 Jun 2007 |
| Total Posts: 1455 |
|
|
| 27 Jun 2012 05:44 PM |
That's odd.. I went in Server Mode, and it appears to work when I run it. Do you have Indicator in Lighting? Or is it spelled right?
Oh, and yes I'm the rocket place guy. |
|
|
| Report Abuse |
|
|
Noahk
|
  |
| Joined: 14 Feb 2008 |
| Total Posts: 1460 |
|
|
| 27 Jun 2012 07:49 PM |
If it works for you, I guess I'll have to take your word for that! I'll do some more online testing. Thanks a ton for your help!
Also, I really must say, excellent place. Really. If I were you I would remake it and advertise a lot. You would make a LOT of tickets. |
|
|
| Report Abuse |
|
|
Noahk
|
  |
| Joined: 14 Feb 2008 |
| Total Posts: 1460 |
|
|
| 27 Jun 2012 08:00 PM |
| Another update. I managed to make it work in server mode(With lots of lag of course) and everything seems to work great. The reason it is unable to determine the right player to make dominator is that everyone in the server was named Player right? |
|
|
| Report Abuse |
|
|
Noahk
|
  |
| Joined: 14 Feb 2008 |
| Total Posts: 1460 |
|
|
| 27 Jun 2012 08:01 PM |
Yet another, I get this error- Workspace.Dominator v3.0:63: attempt to get length of field 'NumPlayers' (a number value) |
|
|
| Report Abuse |
|
|
|
| 27 Jun 2012 08:05 PM |
"randomplyr = playerz[math.random(1, #game.Players.NumPlayers)]"
That line doesn't need the # |
|
|
| Report Abuse |
|
|
Noahk
|
  |
| Joined: 14 Feb 2008 |
| Total Posts: 1460 |
|
|
| 28 Jun 2012 04:37 PM |
| Thanks for that. So, it should work in Online mode[see last post], right? |
|
|
| Report Abuse |
|
|
|
| 28 Jun 2012 05:00 PM |
I found these problems from the original code (some are merely logical errors):
-Indicator only clones once, at the beginning, so if it is removed, you have no way of getting a new one. What I would do is merely move the line that clones it to before you set it's parent. Unless of course Indicator is never removed, even on a player death, then it should be fine. -In line 18, you never defined what "character" was. -For the prints, you used " instead of ' at the beginning. -Logicall with the PlayerEntered bit, it won't run past the while true do loop, instead use:
repeat wait() until character~=nil
If you're checking to wait until the character actually exists (define character first though, obviously XD) -You never actually connected DominatorConnection. |
|
|
| Report Abuse |
|
|
WhiteRain
|
  |
| Joined: 24 Apr 2010 |
| Total Posts: 2723 |
|
|
| 28 Jun 2012 05:08 PM |
@Blad Character is a property of the player. http://wiki.roblox.com/index.php/Character_(Property) |
|
|
| Report Abuse |
|
|
|
| 28 Jun 2012 05:10 PM |
I understand that... I'm saying when you look to the right of the =, you see this:
player.Character.Humanoid.Health = *character.Humanoid.MaxHealth*
and he never defined "character."
|
|
|
| Report Abuse |
|
|