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

Error in recognising the player's team color ?

Asked by
Vlym 19
4 years ago
Edited 4 years ago
-- handling remote event

game.ReplicatedStorage.TeamChange.OnServerEvent:Connect(function(player, TeamColor)

    player.TeamColor = TeamColor
    player:LoadCharacter()

    if player.TeamColor == "Really red" then

        player.Character.HumanoidRootPart.CFrame = CFrame.new(-84.15, 0.5, 125.98)

    else

        player.Character.HumanoidRootPart.CFrame = CFrame.new(-110, 0.5, 62.88)

    end

end)

this script ^ is picking up what is fired from the local script:

-- team change script

local RemoteEvent = game.ReplicatedStorage.TeamChange

local menuButton = script.Parent:WaitForChild("TeamChangeButton")

local frame = script.Parent:WaitForChild("TeamFrame")

-- team colours

local RedTeamColor = "Really red"
local BlueTeamColor = "Really blue"

frame.RedTeamButton.MouseButton1Click:Connect(function()

    RemoteEvent:FireServer(BrickColor.new(RedTeamColor))

end)

frame.BlueTeamButton.MouseButton1Click:Connect(function()

    RemoteEvent:FireServer(BrickColor.new(BlueTeamColor))

end)

menuButton.MouseButton1Click:Connect(function()

    frame.Visible = not frame.Visible

end)

but in the handling remote event script, the script is only playing the "else" function after loading my character. Is there something wrong with player.TeamColor ?

0
Try printing player.TeamColor sheepposu 561 — 4y
0
When doing this stuff, you can use string.lower on the player.TeamColor just to make sure that caps won't lead to errors sheepposu 561 — 4y

Answer this question