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

FireServer can only be called from the client??

I made this script but im not sure whats wrong with it. IT keeps giving me the error "FireServer can only be called from the client" And it is NOT a local script. This script is in server script service.

local rep = game:GetService("ReplicatedStorage")
local event = rep:FindFirstChild("Events").Kill1
local target = workspace.Quest1:GetChildren()

for i, v in pairs(target)do
	if not v:FindFirstChild("Humanoid")then
		return
	else
		if v:FindFirstChild("Humanoid")then
			v.Humanoid.Died:Connect(function()
				event:FireServer()
			end)
		end
		end
end

local function working()
	while wait(1)do
	print("hi")
	end
end

game.ReplicatedStorage.Events.Kill1.OnServerEvent:Connect(working)

1 answer

✓ Accepted answer

You can only do FireServer in a LocalScript

10 comments

0

hmm... so if i do fire client, it will work?

0

now it does not print "hi"

0

I used OnClientEvent instead of OnServerEvent

0

Yes, but why are you firing a remote when the player dies? You can handle this with a regular script without needing a remote.

0

nvm im stupid, just in case its more safer, also not player its for a quest, npc kills

0

I have a question, which one is better number value or int ? Or it doesnt matter?

0

What are those values for?

0

quest kills

0

I think IntValues would be best.

0

ok thanks

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