I'm trying to make a gun and
I want the Gui to update its stats(Ammo, Gun Name, Max Ammo).
ERROR:20:54:15.911 - Unable to cast value to Object
-- This a local script in the Pistol local GunName = 'Pistol' local Ammo = 20 local MaxAmmo = 20 Remote:FireClient(GunName,Ammo,MaxAmmo)
-- This a local script in the StarterGui local Remote = game.ReplicatedStorage:WaitForChild('GunStatsRemote') local Background = script.Parent:FindFirstChild('Background') local AmmoLabel = Background.AmmoLabel local GunLabel = Background.GunLabel Remote.OnClientEvent:connect(function(GunName, Ammo, MaxAmmo) GunLabel.Text = GunName AmmoLabel.Text = Ammo..'/'..MaxAmmo end)
I'm not sure how to fix this problem, I rarely use RemoteEvents.
You can't use a remote event because your communicating between 2 local scripts. You can only use Remote events when communicating between a localScript and a normal Script or vice versa. Instead use a Bindable event http://wiki.roblox.com/index.php?title=API:Class/BindableEvent