Remote event help

I’m trying to figure out remote events so i can kill an npc with melee attacks
so far the event doesnt seem to fire and i have no idea if its the code or the rigs
i have been looking at everything i can find and have followed youtube vids and nope

the aim is that the player touches the npc and is also in the animation then the npc will die but im having no luck. remote events seem to be the only way to do this but i dont think i understand it enough and everything i look at just confuses me more

this is the client side part that doesnt fire


function slideDmg(hit)
	Bob = hit.Parent
	if hit.Parent:FindFirstChild("Humanoid") then
		if SlideTrack.IsPlaying then
			game.ReplicatedStorage.DamageEvent:FireServer(Bob)
			print("fired")
		end
	end
end

foot.Touched:Connect(slideDmg)

if you need more info just ask my brain is fried with all this right now

6 Likes

Is your print statement firing? Maybe try putting it above the remote event. This way you can see if you If statememt is even working

1 Like

that doesnt fire either. its all custom rigs so maybe theres an issue with that i have no idea , but the output shows no errors either

1 Like

If it isnt firing then your if statement is false. Id suggest playing around with the animation

1 Like

do you mean the animation itself or the code for the animation?

1 Like

i should also mention the script is in startercharacterscripts

1 Like

Touched events don’t replicate on the client. You need to put it in a server script.

1 Like

Put a task.wait() after the game.ReplicatedStorage.DamageEvent:FireServer(Bob)

game.ReplicatedStorage.DamageEvent:FireServer(Bob)
task.wait();

print("fired")
1 Like

doing it on ther server script nothing happens also and i just get this
Screenshot 2024-01-26 213938

1 Like

nothing happens when i add task.wait()

1 Like

Thats not even part of your code. Did you update it?

1 Like

Why tho? This won’t do anything

1 Like

Make sure you actually have the game.ReplicatedStorage.DamageEvent

1 Like

Is the entirety of the script? Put a print statement at the beginning of the slideDmg function.

1 Like

no i only showed the function. that line is for the animator

1 Like

It would error if it didnt exist. It doesn’t make it to the firing stage which is what seems to be the problem. hit.Parent probably doesn’t have a humanoid, or SlideTrack is not playing

1 Like

seems to be the whole function yea doesnt print

1 Like

Wheres the script? Server script in starter char scripts? What other code is in this script, and what is the foot variable

1 Like

the slidetrack plays so im not sure and the npc has a humanoid inside it as well would it help to post the rest of the script?

1 Like

It doesnt make it to that part of the script because the function doesn’t even run. We need the rest of the script and what the foot var is

1 Like