RemoteEvent not firing?

  1. What do you want to achieve? I’m making a Multiple Rocket Launch system

  2. What is the issue? The RemoteEvent isn’t firing, there are no errors. I’ve also used BindableEvents and get the same result

Script firing the event:

local ClickDetector = script.Parent.ClickDetector
local CEvent = game.ReplicatedStorage.RocketLauncherEvent1
local Debounce = false

ClickDetector.MouseClick:Connect(function()
	if Debounce == false then
		print("Working 2")
		CEvent:FireAllClients()
		Debounce = true
	end
end)

Script receiving the event:

local Part1 = script.Parent
local CEvent = game.ReplicatedStorage.RocketLauncherEvent1
local ObjectIs = game.Workspace.MRL75

CEvent.OnServerEvent:Connect(function()
	print("Working")
	local Cloned = script.Parent:Clone()
	Cloned.Parent = game.Workspace
	local ChosenSpawn = math.random(1,6)
	if ChosenSpawn == 1 then
		Cloned.CFrame = ObjectIs.First
	end
	if ChosenSpawn == 2 then
		Cloned.CFrame = ObjectIs.Second
	end
	if ChosenSpawn == 3 then
		Cloned.CFrame = ObjectIs.Third
	end
	if ChosenSpawn == 4 then
		Cloned.CFrame = ObjectIs.Fourth
	end
	if ChosenSpawn == 5 then
		Cloned.CFrame = ObjectIs.Fifth
	end
	if ChosenSpawn == 6 then
		Cloned.CFrame = ObjectIs.Sixth
	end
	Cloned.Touched:Connect(function(hit)
		if(hit.Parent.Parent.Name == "MRL75") then
		else
		local Explode = Instance.new("Explosion")
		Explode.BlastRadius = 10
		Explode.BlastPressure = 5000000
		Explode.Parent = game.Workspace
		Explode.Position = Cloned.Position
		script.Parent:Destroy()
		end
	end)
end)

Both scripts are Server scripts, and there are no errors. So I’m not really sure what’s wrong here.

Does this print get fired? image

You need to alter your event connection to

CEvent.OnClientEvent:Connect(function()

You cannot listen to server events from the client. Since you’re firing from the server, you should listen for a client event by using the event and respective connection above.

Happy coding! :slight_smile:

1 Like

More over, if you’re trying to send signals from Server > Server OR Client > Client; you should be using BindableEvents!

I noticed you mentioned both scripts are server scripts.

1 Like

Ah sorry, I forgot to mention I first used BindableEvents yet it didnt work so i tried RemoteEvents

Yes, that one did get fired. Not the other one though.

Just use BindableEvents as they are easy and practical to use. Just :Fire() and .Event:Connect(function()) between scripts, simple.

I feel like you’re overcomplicating this by using an Event at all. Instead I would create a function called CreateSpawnHandler() or something that tells you what the function is doing. Then I would recommend changing your asset management to use either ReplicatedStorage or ServerStorage, change the script.Parent to use the new destination you set the asset to be.

I really don’t see a reason to create multiple scripts for this use case or use any event driven system.

1 Like