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

Why will :FireServer() not work?

Ok, so im trying to make a game where a leaderstat value (food) goes up every second based on the FPS value.

it used to work on my old clicker game, but now it does not :( so i tried making it intro a fire server system like my click button, but for some reason it does not work

Code: (using a normal Script)

--cpsadd

while true do
	game.ReplicatedStorage.SecondEvent:FireServer()
	wait(1)
end

Previous Code:

--cpsadd
plr = script.Parent.Parent.Parent
CPS = plr.leaderstats.extrafps
CPS2 = plr.leaderstats.FPS
CPS3 = plr.leaderstats.Boost2

while true do
	plr.leaderstats.Food.Value = plr.leaderstats.Food.Value + CPS2.Value
	plr.leaderstats.Food.Value = plr.leaderstats.Food.Value + CPS.Value
	plr.leaderstats.Total_Food.Value = plr.leaderstats.Total_Food.Value + CPS.Value
	plr.leaderstats.Total_Food.Value = plr.leaderstats.Total_Food.Value + CPS2.Value
	plr.leaderstats.Food.Value = plr.leaderstats.Food.Value + CPS3.Value
	plr.leaderstats.Total_Food.Value = plr.leaderstats.Total_Food.Value + CPS3.Value
	print("give fps")
	wait(1)
end

Previous code also using local script

1 comment

0

Is this another botted question?

1 answer

Function FireServer can only be called from the client.

In order to send messages from Client to server, you need to use the FireServer Function on a local script and OnServerEvent Event on the server side.

Example:

Local script

local RE=game:GetService('ReplicatedStorage'):WaitForChild('RemoteEvent');
RE:FireServer('wow FE');

Server Script

local RE_1=Instance.new('RemoteEvent',game:GetService('ReplicatedStorage'));
RE_1.OnServerEvent:Connect(function(pl,a)
	print(tostring(a));--> 'wow FE'
end);

16 comments

0

i DID

0

But ill try this

0

But ill try this

0

But ill try this

0

i have game.ReplicatedStorage.SecondEvent.OnServerEvent:Connect(plr)

0

if you did do you mind showing both scripts?

0

oh youre using an event wrong

0

my bad the fire server was on a local script

0

What is wrong, or is there another way to connect it to the player? Im trying to add leaderstats locally

0

well to the player

0

You use the connect for a function argument not a player argument

0

well its in a script in serverscriptservice, how else would i connect it

0

like a normal event (?!?)

0

I literally showed you in the answer

0

You can not use Fire Server in a regular script.

0

Only Invoke Client

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