Hey everyone! I’m struggling with the color-changing system I created for my marble game, where your character is a ball. I thought it would be fairly simple, but I keep getting the error code written above when I try testing it on a multiplayer client. I have a remote function that should pass the color argument of the color buttons to the server to change the color of your ball character, but it either makes the character look black on the server or doesn’t change the color at all. Here is my server script:
Server script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local CC = ReplicatedStorage:FindFirstChild("CC")
function ChangeColor(plr, color)
print(plr)
print(color)
local marble = plr.Character:FindFirstChild("Marble")
if marble then
marble.Color = color
return marble.Color
end
end
CC.OnServerInvoke = ChangeColor
Client Script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local CC = ReplicatedStorage:FindFirstChild("CC")
local Frame = script.Parent.Frame
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Ball = Character:WaitForChild("Marble")
for i, btns in pairs(Frame:GetChildren()) do
if btns:IsA("ImageButton") then
btns.MouseButton1Click:Connect(function(player, color)
color = btns.BackgroundColor3
CC:InvokeServer()
Ball.Color = color
end)
end
end
Sorry if this is a bad way to set it up I’ve just become annoyed for how many times its failed. Any help will be appreciated, thanks