Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can you help me please?i have a problem with spawnpoints

Asked by 5 years ago

I have two teams police and prisoners. i puted around the prison spawnpoints and set them to change team when touch. but i want this to work only with prisoners because when i exit the prison as a police officer it changes my team to criminals.How do i make this work only with prisoners team???

0
if team ~= prisoner then end shanelaw12 64 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Firstly turn off the change team thing in the spawn points, we will do it using scripts. Create a "Folder" in the Workspace called "CriminalSpawns" and put all the criminal spawns in that folder. Now create a script in ServerScriptService and put in the following.

for i,v in pairs(workspace.CriminalSpawns:GetChildren()) do
    v.Touched:Connect(function(hit)
        if hit.Name == "HumanoidRootPart" then
            local player = game.Players:FindFirstChild(hit.Parent.Name)
            if player.Team = game.Teams:FindFirstChild("Prisoners") then
                player.Team = game.Teams:FindFirstChild("Criminals")
                player.Neutral = false
            end
        end
    end)
end

If that doesn't work DM me on discord MachoPiggies#3484!

Ad

Answer this question