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)

10 comments
hmm... so if i do fire client, it will work?
now it does not print "hi"
I used OnClientEvent instead of OnServerEvent
Yes, but why are you firing a remote when the player dies? You can handle this with a regular script without needing a remote.
nvm im stupid, just in case its more safer, also not player its for a quest, npc kills
I have a question, which one is better number value or int ? Or it doesnt matter?
What are those values for?
quest kills
I think IntValues would be best.
ok thanks