So like my previous posts i stated that my scriptings skills are very low, so this time i tried developing my own scripts that my achievement is getting to a plyers whens uses a tool it teams onto another team.
Mu issue is this i can’t develop so well and i don’t understant that much about scripting.
I have tried looking up about functions and teams from roblox official website.
local Team = BrickColor.new("Really red")
local Tool = script.Parent
local plr = game:GetService("Players")
local Teams = game:GetService("Teams")
Tool.Activated:Connect(function()
print("Tool was Fired!")
local plr = game:GetService("Players")
if plr == Teams then
Team = BrickColor.new("Really red")
end
end)
I would be fine if someone could tell me what to use or what in im wrong…
inside of a player you can insert only local scripts but if you change the team of a player with a local script
the others players will not see it so inside of the player you need a local script that will fire a server in replicated storage if the tool was activated then make a normal script that will activate if the server run
and the norrmal script will change the team of the player !
Yeah somewhat like that. But first let me explain like what i want because it will be confusing. So the script i wanted is for a RP game so if a Citizen player fires / uses a gun he is teamed into the “enemy” team, and what i asked you after, was after the “enemy” player dies, He is teamed back to citizen (New life rule thingy to make the “police” team less confused) so your latest script is for like everyone so in terms of rp, if a policeman dies he is teamed into the citizen team. (i hope you understand this)
local team = 'Citizen'
local exceptions = { -- put the name of any team that you dont want teamed back when dead
'Police',
'AnotherTeam',
}
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
wait(1)
character:WaitForChild('Humanoid').Died:Connect(function()
if table.find(exceptions, player.Team.Name) then return end
player.Team = game.Teams[team]
end)
end)
end)
Seems to work, but like when i get shooted and die it doesn’t team me onto the another team. like die from a weapon or stabbed. Only works when i reset manually.