Error with taking damage

So what should I do???

(btw thank you for trying to help me)

1 Like

You used add a remote event into your tool.

And when the remote even is fired, you can add the damage to the player then.

i got another sword but the system is working a bit diff and its working without remote events.

@liamazu1000 Can you send the script/scripts of the model?

Server Script in the tool :

script.Parent.Handle.blade.Touched:Connect(function(hit)
	script.Parent.Activated:Connect(function()
		valval.Value = 15
		if hit.Parent:FindFirstChild("Humanoid") then

			hit.Parent.Humanoid:TakeDamage(valval.Value)
			script.Parent.combo.Value += 1
			script.Disabled = true
			wait(0.5)
			script.Disabled = false
			valval.Value = valval.Value - 15
			
			if script.Parent.combo.Value == 2 then
				local stun = hit.Parent.Humanoid:LoadAnimation(script.Parent.stunAnimation)
				stun:Play()
				script.Parent.combo.Value = script.Parent.combo.Value - 2
			end
			
		end
	end)
end)


LocalScript:

script.Parent.Equipped:Connect(function(mouse)
	local idle = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.equipAnimation)
	local leftSlash = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.leftSlash)
	local rightSlash = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.rightSlash)
	
	
	idle:Play()
	local attack = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation)
	script.Parent.Activated:Connect(function()
		
		if script.Parent.combo.Value == 0 then
			attack:Play()
		end
		
		if script.Parent.combo.Value == 1 then
			leftSlash:Play()
		end
		
		if script.Parent.combo.Value == 2 then
			rightSlash:Play()
			
		end
		
		script.Disabled = true
		wait(0.5)
		script.Disabled = false
	end)
	
end)

script.Parent.Unequipped:Connect(function()
	local idle = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.equipAnimation)
	idle:Stop()
	idle:Stop()
	idle:Stop()
	idle:Stop()
	idle:Stop()
	idle:Stop()
	idle:Stop()
	
end)



I want to help you, but i don’t really know where the problem lies.

Have you tried testing it on a test server?

image

You should see if the damage is taken away from the other players in the test server.

The damage is taken away in the test server.

I don’t see why it’s not working ingame, have you published it?

Are there any other scripts interfering with the sword?

It’s published,
Nope. There not ny scripts interfering with the sword.

I don’t really know. The only think i can think of is using a remote event to damage the player from both client and server.

Try using a remote event.

If that doesn’t work then i don’t know.

Maybe this could be the problem?

https://gyazo.com/67eb1fbd5e8cd96c2616fc66f7aff878

Yes, i think that’s the problem.

Here:

This will show you how to commit scripts.

If this solved your problem, please mark it as a solution.

3 Likes

Thank you so much. You helped me it took me 4 hours to understand that and you just helped me!

1 Like