#Team Changing Event

1 messages · Page 1 of 1 (latest)

plain lance
#

Does anyone know why my event isn't being fired?

local Players = game:GetService("Players")
local tagmod = require(game:GetService("ReplicatedStorage").HeadTagModule)

Players.PlayerAdded:Connect(function(player)
    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = player

    local money = Instance.new("IntValue")
    money.Name = "Money"
    money.Value = 823213
    money.Parent = leaderstats
    
    player.CharacterAdded:Connect(function(char)
        tagmod:CreateHead(player)
    end)
        
    player:GetPropertyChangedSignal("TeamColor"):Connect(function(team: Team)
        print("team changed")
        print(team.Name)
        print(player.Name)
        tagmod:UpdateTeam(player, team)
    end)
end)
exotic flicker
#

You're watching player:GetPropertyChangedSignal("TeamColor"), but assigning a player to a team usually sets the Team property, not TeamColor directly. So this event might not fire if only player.Team is changing. so, Use .Team instead of .TeamColor, and remove the :Team type annotation (because player.Team is a property, not a parameter you pass.

#

although i might jsut be speaking out my ass im fairly new to scripting