generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Super long script help?

Previous Thread :: Next Thread 
Noahk is not online. 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 is not online. 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
socccerstar is not online. socccerstar
Joined: 23 Aug 2008
Total Posts: 489
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 is not online. Noahk
Joined: 14 Feb 2008
Total Posts: 1460
24 Apr 2012 06:51 AM
Nobody's team is changed to bright yellow.
Report Abuse
socccerstar is not online. socccerstar
Joined: 23 Aug 2008
Total Posts: 489
25 Apr 2012 10:26 PM
At the bottom, try "game.Players...".
Report Abuse
thane1326 is not online. thane1326
Joined: 08 Apr 2009
Total Posts: 867
25 Apr 2012 10:31 PM
Yea, thats what I was thinking.
Report Abuse
Noahk is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image