i have a local script for animations and a server script for damage yet the client that "died" is still alive
server script:
1 | script.Parent.Activated:Connect( function () |
2 | script.Parent.Blade.Touched:Connect( function (hit) |
3 | local Humanoid = hit.Parent.Humanoid |
4 | Humanoid.Health = Humanoid.Health - 0.1 |
5 | end ) |
6 | end ) |
local script:
01 | local debounce = true |
02 |
03 | script.Parent.Activated:Connect( function () |
04 | local Swing 1 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Swing 1 ) |
05 | if debounce = = true then |
06 | debounce = false |
07 | Swing 1 :Play() |
08 | game.Players.LocalPlayer.leaderstats.Strength.Value = game.Players.LocalPlayer.leaderstats.Strength.Value + 2 |
09 | game.Players.LocalPlayer.leaderstats.Coins.Value = game.Players.LocalPlayer.leaderstats.Coins.Value + math.random( 1 , 5 ) |
10 | wait( 0.6 ) |
11 | debounce = true |
12 | end |
13 |
14 |
15 | end ) |
That server script is gonna error a LOT. You need to clearly make sure that hit is indeed the part of a character. Here.
01 | local candamage = true |
02 | script.Parent.Activated:Connect( function () |
03 | script.Parent.Blade.Touched:Connect( function (hit) |
04 | local Char = hit:FindFirstAncestorOfClass( "Model" ) |
05 | if Char then |
06 | Hum = Char:FindFIrstChild( "Humanoid" ) |
07 | if Hum them |
08 | if candamage = = true then |
09 | candamage = false |
10 | Hum.Health = Hum.Health - 0.1 |
11 | wait( 1 ) |
12 | candamage = true |
13 | end |
14 | end |
15 | end |
16 | end ) |
17 | end ) |