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

FireServer can only be called from a client?

I'm making an admin command to end the game. I decided to use a remote event since there is 2 seperate scripts, the admin and the main script.

commands.endround = function(sender) -- End current round command

	print("End round command fired by "..sender.Name)
	
	game.ReplicatedStorage.Events.EndRoundCommand:FireServer()
end

When I say "/endround" the print("End round command fired by "..sender.Name) works but the remote event doesn't. "FireServer" can only be called from a client. If needed, this is a normal script.

2 answers

heres a good solution: FireClient and FireAllClients.

FireClient is where you fire to a player. any specific player (you need to reference who in the first parameter).

FireAllClients is where you fire remote to all players.

on local scripts, you don't use OnServerEvent, you use OnClientEvent.

if this is not the solution, then try to put the print in the event listener script, and replace the script you placed in a local script.

1 comment

0

and yes, FireServer can only be called in a local script.

instead of

game.ReplicatedStorage.Events.EndRoundCommand:FireServer()

use

game.ReplicatedStorage.Events.EndRoundCommand:FireClient( (player name you want to send the signal to) )

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