Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

FireServer can only be called from the client?!

Asked by 5 years ago
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

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 Shawnyg 4330 — 5y
0
yes, the only way to fire server is to do that from a local script, maybe the problem is in receiving the server User#23793 0 — 5y
0
But I am firing it from the client, That's the problem GooierApollo664 183 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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

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 GooierApollo664 183 — 5y
Ad

Answer this question