#how do i store and detect team changing

70 messages · Page 1 of 1 (latest)

warm vector
#

.

ruby path
#

Yo

#

@warm vector

#

First if u have a ur team created

ruby path
#

Then place a script like this in serverscriptservice

#

local Teams = game:GetService("Teams")

-- Function to handle team change
local function onTeamChanged(player)
local playerTeam = player.Team
if playerTeam then
print(player.Name .. " changed to team: " .. playerTeam.Name)
-- Add your logic here, e.g., update stats, notify other players, etc.
end
end

-- Listen for players joining
game.Players.PlayerAdded:Connect(function(player)
-- Detect initial team
onTeamChanged(player)

-- Listen for changes in the player's team
player:GetPropertyChangedSignal("Team"):Connect(function()
    onTeamChanged(player)
end)

end)

#

That should work, team scripts are pretty easy to maneuver if u know them

warm vector
ruby path
#

I don't use ai

warm vector
#

interestinh

ruby path
#

This is a basic team script

#

I have experience in this since it's what I mostly do

#

Detects and stores them

#

🙃

warm vector
#

anyways it doesn't work

ruby path
#

Does it align with ur team script u have

#

Same name and everything

#

U can edit

warm vector
#

wdym "same name"

ruby path
#

"Teams"

#

Get service:""

warm vector
#

It

ruby path
#

What is the name for ur team script u have

warm vector
#

It's always the same?

ruby path
#

Make sure it's the same

ruby path
#

How is it not working it's the same I have in my game smh

#

You must have something interfering with it

#

U have a team script already right

warm vector
#

so that's not the issue

ruby path
#

I mean do u have it created

#

Already

warm vector
#

Yeah..?

#

basic common sense

ruby path
#

U placed the script within right place

#

?

warm vector
#

mate im not that stupid enough

#

yes i did

ruby path
#

LOL

#

I MESSED UP

#

Sorry I checked where i got it from

#

Place it in starterplayerscripts

#

Sorry I read it wrong

warm vector
#

my script must be a serverscript

ruby path
#

I said serverscriptservice which is wronggggg

warm vector
#

local scripts wont work

ruby path
#

Oh ok, u want it to start an event or announce when someone switches a team

candid orchidBOT
#

studio** You are now Level 4! **studio

ruby path
#

Notify basically?

warm vector
ruby path
#

What do u mean?

#

I'm no good English sorry

ruby path
#

Basically

#

As a said I read it wrong at first but it still requests teams and applies the lines of code below

#

To store and detect what u want

warm vector
#

teams service is not accesible through local scripts because it's a server sided service

ruby path
#

But I can maybe make it so it work with serverscriptservice if u want

ruby path
#

Is that not what u want?

#

That way it can be server sided

#

If it's just announcing what a team is switched

warm vector
#

and im asking how do i store and detect, i don't want a full ready script since im able to script it by myself

ruby path
#

Sorry I accidentalli poop on the floor men. Was rushing to the bathroom give me secønd