local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
game.Workspace.Part.Touched:Connect(function(touched)
if touched.Parent:FindFirstChild("Humanoid") then
local AnimPlay = touched.Parent.Humanoid:LoadAnimation(Animation)
touched.Parent.HumanoidRootPart.Anchored = true
AnimPlay:Play()
AnimPlay.Stopped:wait() --Waits until it finished playing
touched.Parent.HumanoidRootPart.Anchored = false
player.TeamColor = BrickColor.new("Really red")
if player.TeamColor == BrickColor.new("Really red") then
script.Disabled = true
if player.TeamColor == BrickColor.new("White") then
script.Disabled = false
end
end
end
end)
( this is a local script)
I just need to know how to make it so u go on a certain team if u die.
Create a Server Script in ServerScriptService and paste the following code;
local team = 'putTeamNameHere' -- put your desired team's name here
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character:WaitForChild('Humanoid').Died:Connect(function()
player.Team = game.Teams[team]
end)
end)
end)
I know, itâs supposed to work. but when I reset Iâm still the âInfectedâ team. what I did was in my script, if I touch the block I go on the infected team. What I want is if I die, in any type of way⌠I go back to the âHumansâ team. I shouldnât stay the infected team if I die.
Works for me, make sure itâs a normal Script and not a Local Script, and make sure it is somewhere it can run like Workspace or ServerScriptService. If not that then make sure your âhumansâ team is named âHumansâ
I donât know what to tell you, this is down to you now, I mean iâve provided you with sufficient working code that you needed so any problems are on your side.
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
game.Workspace.Part.Touched:Connect(function(touched)
if touched.Parent:FindFirstChild("Humanoid") then
local AnimPlay = touched.Parent.Humanoid:LoadAnimation(Animation)
touched.Parent.HumanoidRootPart.Anchored = true
AnimPlay:Play()
AnimPlay.Stopped:wait() --Waits until it finished playing
touched.Parent.HumanoidRootPart.Anchored = false
player.TeamColor = BrickColor.new("Really red")
if player.TeamColor == BrickColor.new("Really red") then
script.Disabled = true
if player.TeamColor == BrickColor.new("White") then
script.Disabled = false
end
end
end
end)
this is the local script that might be making it not work⌠(StarterPlayer >> StarterPlayerScripts)
local team = 'Humans'
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
wait(1)
character:WaitForChild('Humanoid').Died:Connect(function()
player.Team = game.Teams[team]
end)
end)
end)