Remoteevents not being able to cast value to object

I’m trying to activate something in another script using a proximity prompt but it doesn’t work
I’ve looked at the other posts and I can’t figure out what is happening
clientside

game.ReplicatedStorage.ammorefill.OnClientEvent:Connect(function(ammo)
	
	magcount = mostmags
	cammo = maxsize
	game.ReplicatedStorage.ammoupdate:FireServer(cammo,magcount,j,b)

end)
	

serverside

button =  script.Parent["ammo refiller"]
ammo = 3


button.Triggered:Connect(function()
	if ammo > 0 then
		game.ReplicatedStorage.ammorefill:FireClient(ammo)
	ammo-=1
	wait(5)
	end
	
end)

it prints unable to assign value when i activate the button

Thats not how FireClient works, the First Argument has to be the Player its running for.

If you want it to fire for all Players, use FireAllClients

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.