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

Why is my remote event not working when I fire it from the client?

So I'm trying to fire a RemoteEvent in ReplicatedStorage from something in PlayerGui. Nothing is working. On my localscript I have 3 lines in between my script.Parent.MouseButton1Click function. One prints "button clicked" the other one fires the server, and the last one prints "event fired". I added a print in the script that controls the RemoteEvent to print out "Event fire detected." but nothing came out, and no errors either but it's not working. Here is my code:

First Button local script:

script.Parent.MouseButton1Click:Connect(function()
	print("button clicked")
	game.ReplicatedStorage.conveyorEvent:FireServer(game.Players.LocalPlayer, "go")
	print("event fired")
end)

Second Button local script:

script.Parent.MouseButton1Click:Connect(function()
	print("button clicked")
	game.ReplicatedStorage.conveyorEvent:FireServer(game.Players.LocalPlayer, "stop")
	print("event fired")
end)

and my script for my RemoteEvent is a server script that is a descendant of the actual event.

What will fix it?

2 comments

0

I don't think you need to give the player as the first parameter when firing from client to server

0

although from server to client you do

1 answer

You dont need to fire the LocalPlayer as your first parameter, its automatically added. Heres an example

game.ReplicatedStorage.RemoteEvent:FireServer("argument here", "argument2")

So you should remove the first parameter you added as a solution.

2 comments

0

I removed it but it didn't work

0

could you post the the line of code where you're firing the remote, and the line of code where your script recieves and handles the fired request?

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