GUI Dosen't Change Visually On Client

Hello. I’m having a pretty weird issue. My issue is this:

I have a GUI being edited by a local script, and the value changes in the explorer, but never visually changes.

This is the code in a local script:

local MouseService = game.Players.LocalPlayer:GetMouse()
UserInputService = game:GetService("UserInputService")
print("Loading...")
Hud = script:WaitForChild("WeaponHud",9999999)
print("Hud Loaded?")
if Hud then
	print("Found Hud")
	Hud.Parent = game.Players.LocalPlayer.PlayerGui
	TotalAmmoDisplay = Hud:WaitForChild("Frame",999999999):WaitForChild("TotalAmmo",999999999)
	print("Found AmmoDis")
	AmmoCurrent = Hud:WaitForChild("Frame",999999999):WaitForChild("ClipAmmo",999999999)
	print("FoundAmmoCurrent")
	TotalAmmoDisplay.Text = SettingsService.Settings.Ammo.ClipStorage - 0 --0 IS needed.
else
	error("[Green's Weapon System]: Failed to Find HUD.")
end
print("next")
Tool:WaitForChild("ModifyGui").OnClientEvent:Connect(function(AmmoVar)
			print("Editing "..tostring(AmmoVar))
		AmmoCurrent.Text = tostring(AmmoVar)
end)
print("Rest is FINE")

And this is the server script part that fires it:

						script.Parent.ModifyGui:FireClient(player,Ammo)

This is a pretty big issue for me, because I have a client waiting on this.

Anyone know a solution?

If the gun is a tool you may want to put the script inside of it.

1 Like

This is the current file path.

I will look at it when I get on my pc later.

I presume your core code that handles everything gun related is in that ServerScript? One way how I did it was to do all the input handling and what not (such as when the player shoots) inside of a localscript in the tool itself and when something had to be shown to the client, a remoteevent is fired (to make shooting work for example)

For your code, I’m not sure what would the issue be since I’ve never seen gun stuff done like this before, maybe it could be how the hud is made itself since everything is working besides displaying the new value. If this is the only gui that’s going to be displayed (aka there’s no other guis for different guns), try immediately placing the gui inside startergui instead of making the script do it and change your code to reference that instead

1 Like