Remote event not firing

I am working on a placement system, you place a block and the whole server can see it. I have run into a issue while doing this, when I want to fire this remote event it wont fire.

print("structure")
posX = mouse.Target.Position.X
posY = mouse.Target.Position.Y
posZ = mouse.Target.Position.Z
print(posX,posY,posZ)
					
					
script.Parent.Structure:FireServer(posX,posY,posZ,snap,surface)

It prints out the prints in the output but the print in the server script doesn’t show in output, Meaning that the remote event isn’t firing, can anyone help me with this?

Hello! May I please see how you initialized your remote event at the top of your script?

Or better yet, would you mind showing how you established the “.OnServerEvent” listener on your server script?

the local script and server script were inside a tool, so was the remote event, here’s the server script

script.Parent.Structure.OnClientEvent:connect(function(plr,posX,posY,posZ,snap,surface)
   print("Hi")
end)

isnt it on server event not onclient event

Ok yes yes, thank you. Considering you are establishing the listener on the server, you would use “.OnServerEvent” instead of “.OnClientEvent”

oop sry i meant to put on server event, my studio is playing up so i retyped script in here

Oh okay, no worries! Well here is an idea. What I often like to do is place my remote events in a folder and house them under ReplicatedStorage. Then reference the event I want to use (In your case, Structure) on both the local and server script from the new location instead of using Script.Parent.

In essence, you would do:
local Structure = game:GetService("ReplicatedStorage").Folder:WaitForChild("Structure") On both client and server script.
You can name .Folder whatever you want.

Then proceed to do:
Structure:FireServer(params) on the client

And:
Structure.OnServerEvent:Connect(args) on the server

hehe

ok thank you, I will try this.

1 Like

Sure, no problem! Let me know how it goes

1 Like