Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why won't this transfer information with the RemoteEvents?

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.

1 answer

✓ Accepted answer

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

2 comments

0

Oooooooo

1

ya, i ran into the same problem a couple weeks ago too. so i hope this helped :)

This discussion is preserved as it was. New answers, comments, and votes are closed.