(Basically, Team are spawning on the wrong “SpawnLocation”)
Script:
local MarketplaceService = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer
local GamepassID = ******
script.Parent.MouseButton1Click:Connect(function()
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, GamepassID)
then player.Team = game.Teams:WaitForChild("test")
player.Character.Humanoid.Health = 0
end
end)
You doing team change on client side. This should be executed by server. You may use for this RemoteEvent
Here’s my example:
Client script
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.TeamsRE:WaitForChild("test")
end)
Server script
local Remote = Instance.new("RemoteEvent",game.ReplicatedStorage)
Remote.Name = "TeamsRE"
local MarketplaceService = game:GetService("MarketplaceService")
local GamepassID = 0
Remote.OnServerEvent:Connect(function(Player,Team)
if MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamepassID) then --// Checks if player have gamepass
local team_ = game.Teams:FindFirstChild(Team) --// Find team
if team_ then --// If team found
Player.Team = team_ --// Sets team
Player:LoadCharacter() --// Respawn character
end
end
end)