-
What do you want to achieve?
I want to make it so that everyone sees the same random color, and it is not different for every client. -
What is the issue?
I assume because of the function at the top that’s finding the local player, everything is happening locally but I want the same ui to replicate to everyone’s client. -
What solutions have you tried so far?
I tried making the UI in a local script and connect to a remote event in the server script, but it didn’t work at all.
Basically, I’m trying to make a simple game where it makes a random color disappear, and the UI is supposed to tell the player which color to go to in order to be safe. The game works well, but when testing the game in multiplayer, everyone is given a different color, even though it is intended to give everyone the same color. I’m not sure how to go about making it replicate to every player, and I tried using remote events but it didn’t work at all because I don’t know much about remote events, so if anyone knows what to do please tell me!
Here is the code that changes the UI (Normal script in ServerScriptService):
game.Players.PlayerAdded:Connect(function(LocalPlayer)
while true do
if playerBox.Value > 0 then
local colorFrame = LocalPlayer.PlayerGui.GameGui.Color
local background = LocalPlayer.PlayerGui.GameGui.Background
local intermission = LocalPlayer.PlayerGui.GameGui.Intermission
task.wait(0.1)
gametrue.Value = false
ChosenColor = colorNumsArray[random:NextInteger(1, #colorNumsArray)]
print(ChosenColor)
colorFrame.BackgroundColor3 = ChosenColor.Color
colorFrame.Visible = true
background.Visible = true
task.wait(GameTime)
removeColor()
stopMusic()
colorFrame.Visible = false
background.Visible = false
GameTime = GameTime - 3
print("Removed colors")
task.wait(5)
respawnColors()
currentfloor:FindFirstChildWhichIsA("Folder"):Destroy()
playMusic()
GameTime = 6
gametrue.Value = true
elseif playerBox.Value < 1 then task.wait(5)
end
end
end)