It's a server script inside of a MeshPart in the player, it uses RemoteEvents that are called by a LocalScript in the PlayerGui
The LocalScript is in a colour palette gui which constantly updates a Color3 value in PlayerGui and then fires the RemoteEvent which the part then picks up, the problem is it uses the numbers that the Color3 value initially had when the player spawned and not using the updated ones, but if I use the exact same code in a LocalScript (replacing the stuff about the Events with a while true do loop) it works perfectly fine and updates the color with the new Color3 value
This is the script in the MeshPart:
game.ReplicatedStorage:FindFirstChild(script.Parent.Parent.Parent.Name).Colour.OnServerEvent:Connect(function() game.Players:WaitForChild(script.Parent.Parent.Parent.Name) Ply = game.Players:FindFirstChild(script.Parent.Parent.Parent.Name) PlyGui = Ply:FindFirstChild("PlayerGui") Val = PlyGui:FindFirstChild("EnergyColor").Value print("T") script.Parent.Color = Val print("Te") end)
It prints everything as well and no errors come up in the Output console, what is the possible problem/ fix? I don't want to use a LocalScript because then the color changes will all be client-side only