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

Colour changing script that uses a Color3 value not working properly?

Asked by 3 years ago
Edited 3 years ago

So I have a colour palette gui which constantly updates a color3 value in the PlayerGui and as it does so it fires a RemoteEvent which is picked up by a normal script in the Player (since the player is morphed and the parts have a colour changing script in them) the problem is that this script uses the color3 value that it was when the value was loaded in playergui (so if you change the colour even though the value changes the script still uses the old value and changes the part to that colour for some reason, I added some prints to test it and everything is printing as well which is even more baffling, what may be causing this? Here is the script that's in the bricks to change the colour to the color3 value:

"game.ReplicatedStorage:FindFirstChild(script.Parent.Parent.Parent.Name).Colour.OnServerEvent:Connect(function() game.Players:WaitForChild(script.Parent.Parent.Parent.Name) wait(0.000000000000000005) local Ply = game.Players:FindFirstChild(script.Parent.Parent.Parent.Name) local PlyGui = Ply:FindFirstChild("PlayerGui") local Val = PlyGui:FindFirstChild("EnergyColor").Value print("T") script.Parent.Color = Val print("Te") --Ply.playerstats.ArmourColor.Value = game.Players:FindFirstChild(script.Parent.Parent.Parent.Name).PlayerGui.PaletteGui.ColorFinal.Value --PlyGui.ArmourColor.Value = PlyGui.PaletteGui.ColorFinal.Value wait(0.000000000000000005) end)"

NOTE: The thing that’s even more baffling about this is the fact that if I put the exact same thing in a local script (obviously without the RemoteEvents) and make it so it uses a while true do loop then it works perfectly fine and updates the colours as the color3 value updates, the server script it’s in just uses the original color3 value, I even made it so when the event is fired it would change the brickcolor to “Really black” and then to the color3 value and it changes it to black but then back to the original color3 value, but if I use a LocalScript instead everything will be client-side so only you will see the colours changing

1
You can't wait for a that short amount of time Spjureeedd 385 — 3y

Answer this question