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
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
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
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.
3 comments
Yes, FireServer can only be called from the client. And, do some research: https://scriptinghelpers.org/questions/29293/how-to-use-clickdetectors-with-filteringenabled
yes, the only way to fire server is to do that from a local script, maybe the problem is in receiving the server
But I am firing it from the client, That's the problem