I was trying to script some team changing though once I thought I finished it didn't work like it did before. Here is my scripting on both scripts:
-- Team change script -- Add our teams
local RemoteEvent = game:ReplicatedStorage.Teamchange
local menuButton
local frame = script.Parent:WaitForChild("Frame")
-- TEAM COLOURS
local Visitor/GuestColor = "Fossil" local FactoryWorkerColor = "Neon orange"
frame.Visitor/Guest.MouseButton1Click:Connect(function() RemoteEvent:FireServer(BrickColor.new(Visitor/GuestColor)) end)
frame.FactoryWorker.MouseButton1Click:Connect(function() RemoteEvent:FireServer(BrickColor.new(FactoryWorkerColor)) end)
That was my first script. Now my second:
-- Handle the remote event
game.ReplicatedStorage.Teamchange.OnServerEvent:Connect (function(player,teamColor) player.TeamColor = teamColor player:LoadCharacter() end)
There are a few problems here. Variable names must be composed of alphanumeric characters and underscores, so "Visitor/GuestColor" is not a valid name. Omit the slash.
When accessing children of ReplicatedStorage from the client, you should use WaitForChild. So this line:
local RemoteEvent = game:ReplicatedStorage.Teamchange
Should become:
local RemoteEvent = game.ReplicatedStorage:WaitForChild("Teamchange")
Also, the syntax was wrong. When accessing a service, either use dot notation or game:GetService.