Player Overhead Gui Issues

Hey Devforum! I’m trying to maker a player overhead GUI change when a color is selected on the color wheel. So the Overhead GUI is working at first but when the player resets I don’t know how to bring back what they selected and only keep the color change to that client but show it to all clients or the server. The overhead GUI is stored in ReplicatedStorage.Gui.PlayerGui

Local Script:

local button = script.Parent
local LocalPlayer = game.Players.LocalPlayer
local ChangeName = game.ReplicatedStorage:WaitForChild("ChangeName")


local function triggerEvent(color)
	ChangeName:FireServer(color)
end


local function onButtonActivated()
	local Char = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
	local hum = Char:WaitForChild('HumanoidRootPart')
	local num = script.Parent.Parent.Value.Value
	hum.PlayerGui.PlayerTime.TextColor3 = num
	triggerEvent(num)
	script.Parent.Parent.Parent.ColourWheelGui.Enabled = false
end

button.Activated:Connect(onButtonActivated)

ServerScript:

local ChangeName = game.ReplicatedStorage:WaitForChild("ChangeName")
ChangeName.OnServerEvent:Connect(function(player, num)
	local character = player.Character
	if character then
		character.HumanoidRootPart.PlayerGui.PlayerTime.TextColor3 = num
	end
end) 
2 Likes

Have you tried checking to see if you’ve disabled the reset on spawn property in the gui?

1 Like

Print num and see what it outputs.

Yeah I just did although it still doesn’t work.

09:36:30.900 0.93989, 0.203636, 0.446672 : Prints that (the color)

Keep that one print, and below it, add a print(typeof(num)).

I think I found my problem. The GUI gets added every time the character is added .CharacterAdded so when they reset a new gui is added into their HumanoidRootPart. I know this but I don’t know how to fix my issue, any help will work.

function giveGui(character) local player = game.Players:GetPlayerFromCharacter(character) local HumanoidRootPart = character.HumanoidRootPart if player ~= nil then local playerGui = game.ReplicatedStorage.Gui.PlayerGui:Clone() playerGui.Parent = HumanoidRootPart if HumanoidRootPart:FindFirstChild("Color3Value") and HumanoidRootPart:FindFirstChild("Color3Value").Value ~= {0, 0, 0} then playerGui.PlayerTime.TextColor3 = HumanoidRootPart.Color3Value.Value end end end

Same script different line:
game.Players.PlayerAdded:Connect(function(player) timeGive()

2 Questions.

  1. Why are you using a ServerScript to change properties of a ScreenGui’s descendant?
  2. Why are you getting PlayerGui from the HumanoidRootPart?

Prints: Color3

charssssssssssssssssssssss

Have you also tried the following?
character.HumanoidRootPart.PlayerGui.PlayerTime.TextColor3 = Color3.new(num)

  1. The Serverscript is connected to a remote event. I don’t know any other way to do it.

image

Yes. My problem is after the player resets.
https://gyazo.com/6e2ae729eda151fcffaa86e8dc548d65
Then
https://gyazo.com/08153d65fbcda3c7a4c2c2711f5c3aa3

PlayerGui gets replicated to the players HumanoidRootPart

Where is this in explorer?

image

Also if you dont mind reading my reply to shadowmaster because I think there is where the issues stands.

local button = script.Parent
local LocalPlayer = game.Players.LocalPlayer
local Char = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local ChangeName = game.ReplicatedStorage:WaitForChild("ChangeName")

triggerEvent(script.Parent.Parent.Value.Value)

local function triggerEvent(color)
	ChangeName:FireServer(color)
end


local function onButtonActivated()
	local hum = Char:WaitForChild('HumanoidRootPart')
	local num = script.Parent.Parent.Value.Value
	hum.PlayerGui.PlayerTime.TextColor3 = num
	triggerEvent(num)
	script.Parent.Parent.Parent.ColourWheelGui.Enabled = false
end

button.Activated:Connect(onButtonActivated)

Try this, and make sure the ScreenGui which is called ColorWheelGui has the property ResetOnSpawn set to false.

Thank you I’ll try this soon and get back to you.

Still doesn’t work sadly.

charrrrrrrrrrrrssssssssss

Any errors? Did you set ResetOnSpawn to false?