Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make this script only apply to a certain team?

Ok so my game has this ragdoll death animation but I only want it to apply for a certain team, how would I do this? Here is the script --Put in ServerScriptService

game.Players.PlayerAdded:connect(function(player) player .CharacterAdded:connect(function(character) script.RagdollClient:Clone().Parent = character

    character:WaitForChild("Humanoid").Died:connect(function()
        character.UpperTorso:SetNetworkOwner(player)
    end)
end)

end)

1 answer

✓ Accepted answer

Use an if statement.

Anytime a character is loaded have the script look at the players team :)

local team = game.Teams.RedTeam
game.Players.PlayerAdded:connect(function(player) 
	player.CharacterAdded:connect(function(character) 
		if player.Team == team then--through in an if statement
			script.RagdollClient:Clone().Parent =character
			character:WaitForChild("Humanoid").Died:connect(function()
	       			character.UpperTorso:SetNetworkOwner(player)
	    		end)
		end
	end)
end)

P.S..I think thats the same code as yours, its kind of a mess in your question lol. just take a look at the if statement.

1 comment

0

Thanks, it worked :)

This discussion is preserved as it was. New answers, comments, and votes are closed.