#how do i fix ts, im tryna make the handle change color to the team color

1 messages · Page 1 of 1 (latest)

surreal basin
robust mural
#

is this local or server script

surreal basin
robust mural
surreal basin
#

il try

robust mural
# surreal basin il try

use this ```lua
local handle = script.Parent

local function setHandleColor(player)
handle.Color = player.TeamColor
end

game.Players.PlayerAdded:Connect(setHandleColor)

surreal basin
#

ok

#

aint working for som reason

robust mural
#

any errors?

surreal basin
#

ill see

surreal basin
#

wait a sec

robust mural
# surreal basin wait a sec
local handle = script.Parent.Handle
local Players = game:GetService("Players")
local tool = script.Parent

local function setHandleColor(player)
    if player and player.TeamColor then
        handle.Color = player.TeamColor.Color
    else
        warn("No player or player has no TeamColor!")
    end
end

tool.Equipped:Connect(function()
    local character = tool.Parent
    local player = Players:GetPlayerFromCharacter(character)
    setHandleColor(player)
end)
#

there

#

it actually works just make sure its inside the tool not handle

#

or set the handle at the top to script.Parent

smoky adder