You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
im trying to make a death count for an npc
What is the issue? Include screenshots / videos if possible!
theres no errors in the output but it wont add 1 point to the value
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
ive tried this:
server
local Humanoid = script.Parent.Humanoid
function Dead()
remote:FireAllClients()
end
Humanoid.Died:Connect(Dead)
client
local remote = game.ReplicatedStorage.RemoteEvent
local function changed()
script.Parent.score.Value += 1
end
remote.OnClientEvent:Connect(changed)
Jeremiahbabers:
im trying to make a death count for an npc
Um, OnClientEvent
can only be used on the client-side
I think you switched the 2 up, you should call FireAllClients()
on the server as a Script, and OnClientEvent()
on the client as a LocalScript
1 Like
sorry i switched the identification
its actually in the right scipts
you cannot use a OnClientEvent on a server script so instead you would need to use it on a local script and FireAllClients on a server script
i ment to put
client with
remote.OnClientEvent:Connect(function()
script.Parent.score.Value += 1
script.Parent.Text = script.Parent.score.Value
end)
and server
local Humanoid = script.Parent.Humanoid
function Dead()
remote:FireAllClients()
end
Humanoid.Died:Connect(Dead)
D0RYU
(nici)
July 18, 2021, 6:27pm
#6
with this one quote you guys should have realized it was most likely an error in the post
obviously he has the OnClientEvent in the right place
i just fix the post… sorry about that
Well for one, you’re changing the score.Value
on the client which the SERVER will not detect if you handle any server-sided sanity checks
If you’re trying to just change the Text to what score.Value
is supposed to be, try implementing a print statement or 2
the local script didnt even run
what im trying to do is if the npc dies, it sends a signal to a remote event which the local script was supposed to listen for it. then add 1 point to the value
Well I don’t understand what your trying to do, are u trying to give every player a point when a humanoid dies?
nvm i rewrote my code and it works. thanks for the help though