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

Team change script for my game isnt working?

Asked by 2 years ago

So my friend and I are making a game where we throw cookies at each other and I needed to make a team change script so I followed a tutorial and it kind of works when I click red or blue it just sets my team to neutral. Thanks!

Script in server script service:


game.ReplicatedStorage["Change Team"].OnServerEvent:Connect(function(player,teamColor) player.TeamColor = teamColor player:LoadCharacter() end)

local script in my gui:

local RemoteEvent = game.ReplicatedStorage["Change Team"]

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

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

local BlueColor = "Really Blue"
local RedColor = "Really Red"

frame.blue.MouseButton1Click:Connect(function()
    RemoteEvent:FireServer(BrickColor.new(BlueColor))
end)


frame.red.MouseButton1Click:Connect(function()
    RemoteEvent:FireServer(BrickColor.new(RedColor))
end)

menuButton.MouseButton1Click:Connect(function()
    frame.Visible = not frame.Visible
end)

1 answer

Log in to vote
1
Answered by 2 years ago

The second word of the BrickColor names should not have a capital letter.

Please reference this article on how BrickColor names are capitalized.

0
Thanks I will try this when I get home! User#39520 0 — 2y
0
OH MY GOSH IM SO DUMB THANKS User#39520 0 — 2y
Ad

Answer this question