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: What is wrong

Previous Thread :: Next Thread 
iceprofit is not online. iceprofit
Joined: 11 Apr 2013
Total Posts: 417
04 Dec 2013 07:57 PM
What do I need to add? I spawn at the right spawn on entry, but after resetting it spawns me somewhere random.

WOJid = 187343
alliesgroupids = {137436} --Add the ids of WOJ allies.

WOJteamname = "WOJ Members"
alliesgroupteamname = "WOJ Allies"
enemyteamname = "Raiders"

--Don't change below this line.
function checkallies(person)
for i = 1,#alliesgroupids do
if person:IsInGroup(alliesgroupids[i]) then return true end
end
return false
end

function changeteam(player)
if player:IsInGroup(187343) then
player.TeamColor = game.Teams[WOJteamname].TeamColor
player.Character:MoveTo(game.Workspace.WOJ.Position)
elseif checkallies(player) == true then
player.TeamColor = game.Teams[alliesgroupteamname].TeamColor
player.Character:MoveTo(game.Workspace.Allies.Position)
else
player.TeamColor = game.Teams[Raiders].TeamColor
player.Character:MoveTo(game.Workspace.Raiders.Position)
end
end

game.Players.ChildAdded:connect(changeteam)

Report Abuse
iceprofit is not online. iceprofit
Joined: 11 Apr 2013
Total Posts: 417
04 Dec 2013 07:58 PM
bump

#ᴆᴓmiᴎusᴆeals
Report Abuse
EchoReaper is not online. EchoReaper
Joined: 14 Oct 2008
Total Posts: 4323
04 Dec 2013 07:59 PM
You need to run this every time the player re-spawns. Right now, you check when a player is added and them move them to the correct spawn, but you aren't checking for when they re-spawn.

Use .CharacterAdded() to check each time the player's character re-spawns.

http://wiki.roblox.com/index.php/CharacterAdded_%28Event%29
Report Abuse
VanillaLight is not online. VanillaLight
Joined: 02 Nov 2013
Total Posts: 834
04 Dec 2013 07:59 PM
function checkallies(person)
for i = 1,#alliesgroupids do
if person:IsInGroup(alliesgroupids[i]) then return true end
end
return false
end

Eww

function checkallies(person)
for i,v in pairs(alliesgroupids) do
if person:IsInGroup(v) then
return true
end
end
return false
end
Report Abuse
VanillaLight is not online. VanillaLight
Joined: 02 Nov 2013
Total Posts: 834
04 Dec 2013 08:07 PM
Just rewrote it for you

groupid = 187343
allies = {137436}

grouptn = "WOJ Members"
allytn = "Allies"
enemeytn = "Raiders"

function checkallies(person)
for i,v in pairs(allies) do
if person:IsInGroup(v) then
return true
end
end
return false
end

game.Players.PlayerAdded:connect(function changeteam(player)
if player:IsInGroup(groupid) then
print("Player is in the group")
player.TeamColor = game.Teams[grouptn].TeamColor
player.Character.Torso.CFrame = CFrame.new(game.Workspace.WOJ.Position)
elseif checkallies(player) then
print("Player is an ally")
player.TeamColor = game.Teams[allytn].TeamColor
player.Character.Torso.CFrame = CFrame.new(game.Workspace.Allies.Position)
else
print("Player is a raider")
player.TeamColor = game.Teams[enemeytn].TeamColor
player.Character.Torso.CFrame = CFrame.new(game.Workspace.Raiders.Position)
end
end)
Report Abuse
VanillaLight is not online. VanillaLight
Joined: 02 Nov 2013
Total Posts: 834
04 Dec 2013 08:08 PM
Just set the spawn's team to the specific teamcolor, and uncheck neutral.
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