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 the client?!

script.Parent.ClickDetector.MouseClick:Connect(function(player)
	game.ReplicatedStorage.RemoteBuy:FireServer()
end)

When I click the part it says that Client Can't call FireServer. I tried changing it to local Script, but it didn't work

3 comments

0

Yes, FireServer can only be called from the client. And, do some research: https://scriptinghelpers.org/questions/29293/how-to-use-clickdetectors-with-filteringenabled

0

yes, the only way to fire server is to do that from a local script, maybe the problem is in receiving the server

0

But I am firing it from the client, That's the problem

1 answer

I believe what you want is FireClient. Assuming you have a local script ready to be executed OnClientEvent then:

script.Parent.ClickDetector.MouseClick:Connect(function(player)
    game.ReplicatedStorage.RemoteBuy:FireClient(player)
end)

Best of luck developer! Hoped this helped!

Btw you might have messed up the order. The local script should be OnClientEvent. Not OnServerEvent

1 comment

0

I'm confused because it worked all the time, but yesterday it stopped working and I started getting this error. I don't have a local script ready to be executed OnClientEvent. When RemoteBuy is fired, OnServerEvent, Script in ServerScriptService does something. Until yesterday I was simply firing server from this script and then OnSeverEvent, I was doing something, but now I can't do that

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