I'm working on a script, it's basically some special powers(The force from star wars). Now to the point. One of the powers kills other plays by slowly damaging them 15 damage, plus an animation. Now, I've used Mouse.Target to get the humanoid. When I use the script on a NPC it works perfectly. However, when I use it on another player, all damage is only local to me and the animation doesn't work. All of this is done via a localscript.
So therefore I decided to re-do the script and switch to a remote event and use :FireServer(). Here's what the new remote event script looks like.
script:WaitForChild("RemoteEvent).OnServerEvent(function()
print("Server fired")
local Target = script.Parent
local Loader = Target:LoadAnimation(script:WaitForChild("ChokeForce"))
Loader:Play()
Target.Walkspeed = 0
Target.Health = Target.Health-15
wait(0.68)
Target.Health = Target.Health-15
wait(0.68)
Target.Health = Target.Health-15
wait(0.68)
Target.Health = Target.Health-15
wait(0.68)
Target.Health = Target.Health-15
Target.Health = 0
end)
That script is taken and placed into the target(The one getting killed)'s humanoid. And this is the PART of the script that fires the remote event.
if Mouse.Target.Parent:FindFirstChild("Humanoid") then
print("Humanoid found")
Target = Mouse.Target.Parent:FindFirstChild("Humanoid")
Clone = script.Parent.KillScript:Clone()
Clone.Parent = Target
wait()
Target:FindFirstChild("KillScript"):WaitForChild("RemoteEvent"):FireServer()
Disregard the missing end as it isn't missing in the original script. Now to the point, the event that is fired is taken and placed inside of the player's humanoid and fires in there. The :FireServer() is located inside of a tool the localplayer is holding. Yet, nothing out of it. No error output, it doesn't print the "Server fired" which indicates that it isn't firing. Does anyone know the issue?

10 comments
I suggest re arranging the location of everything. You can put the RemoteEvent in the ReplicatedStorage, the ServerScript in the ServerScriptService. Next change some variables and it should work
you: all of this is done via a localscript. also you: the damage is only local to me. Did u try putting it in a normal script?
You'll also want to put Connect between OnServerEvent(function() I believe
Thanks for the quick reply. Responding to vissequ: There is a :Connect. I just forgot to add in here while typing it out. Responding to VVickedDev: I can't move it to a normal script since I need a localscript to get the mouse of the local player in order to may a KeyDown function. Responding to BlackOrange3343: I'll be trying that out, I'll add a comment to tell you the result.
BlackOrange, I've changed what I could. The remote event is now in replicated storage. It actually fired but the one that fired was the one located inside my tool and not the one that was place inside of my target. And the script that fires the remote event can't be placed inside of ServerScriptService as it's for a tool, and not a power for everyone in the server.
Adding on to my comment above. In order to fix the incorrect script from firing I've attempted to disable the one located inside of my tool. And the copy placed inside of my target's humanoid is enabled. No effect, nothing occurred. Not sure what to do.
if you message me on discord vissequ#1301 i can take a look at the project file
For the first line that's receiving the fired event, use a " and a :Connect
Ex: script:WaitForChild("RemoteEvent").OnServerEvent:Connect(function(Put Your Passing Arguments Here (Ex: damage, health,dead)) Ex: script:WaitForChild("RemoteEvent").OnServerEvent:Connect(function(player,damage,health)
:WaitForChild("RemoteEvent) nice