Hey, I am making a game where there are three teams, Gods, Mortals, and Mortal Heroes. In the game, there can only be one player on the Gods team at a time and after the God dies, he respawns as a mortal. I have already made a working script for both of those things. Now I need help making a script that will make it so that if someone on the Mortal Heroes team (or any team really) kills the player on the Gods team, then the player on the Mortal Heroes team that killed the player on the Gods team will respawn on the Gods team. Does anyone know how I can do this?
Team Colors (In case you need them): Gods = Lapis Mortals = New Yeller Mortal Heroes = Really Red
If you have any other questions you can either post them in the comments section or message me on Roblox, I will check both and try to respond as soon as possible.
Thanks, Skyraider5
It's easy peezy!
Following TheeDeathCaster's flaws on my previous script version, I updated the script.
Try the following:
local matchTeam = game.Teams["Mortal Heroes"] --If it's MortalHeroes instead of Mortal Heroes, please fix the variable with "game.Teams.MortalHeroes" Players = Game:GetService("Players") Players.PlayerAdded:connect(function(Player) --// You can add other stuff here, too. Player.CharacterAdded:connect(function(Character) local Humanoid = Character:WaitForChild("Humanoid") Humanoid.Died:connect(function() if Player.Team = game.Teams.Gods then Player.Team = matchTeam end if Humanoid:FindFirstChild("creator") ~= nil then -- Checks for a Killed local Killer = Humanoid.creator.Value -- Gets Killer if Killer.Team== matchTeam then Killer.Team = game.Teams.Gods end end end) end) end)
If this works, please mark as the solution!
As always, good scripting!