How to get enemy player in this situation?
I have come upon a halt in my script.
There isn't any bugs or anything, its just I cant figure out how I can get it in this situation!
Here is the script:
01 | local EventE = game:GetService( "ReplicatedStorage" ).Remotes.RemoteE |
02 | local DisableAttack = game:GetService( "ReplicatedStorage" ).SpecialRemotes.DisableAttack |
03 | local EnableAttack = game:GetService( "ReplicatedStorage" ).SpecialRemotes.EnableAttack |
04 | local TweenService = game:GetService( "TweenService" ) |
05 | local Animations = script:FindFirstChild( "Animations" ) |
06 | local Sounds = script:FindFirstChild( "Sounds" ) |
07 | local Particles = script:FindFirstChild( "Particles" ) |
10 | game:GetService( "Players" ).PlayerAdded:Connect( function (player) |
11 | local cooldown = Instance.new( "NumberValue" ) |
12 | cooldown.Value = tick() |
13 | cooldown.Name = "Cooldown" |
14 | cooldown.Parent = player |
17 | EventE.OnServerEvent:Connect( function (player,cooldown) |
18 | if tick() - player.Cooldown.Value > cooldown then |
19 | player.Cooldown.Value = tick() |
20 | local char = player.Character |
21 | local hum = char.Humanoid |
22 | local humRP = char.HumanoidRootPart |
23 | local Head = char.Head |
25 | local tweenActive = true |
26 | local torso = char.Torso |
27 | local Run = hum:LoadAnimation(Animations.Run 1 ) |
28 | local React = hum:LoadAnimation(Animations.React) |
29 | local Sound = Sounds.Reaction:Clone() |
30 | local Particle = Particles.SSJParticle:Clone() |
36 | Particle.Parent = Head |
38 | local tween = TweenService:Create(humRP,TweenInfo.new(. 75 ,Enum.EasingStyle.Linear,Enum.EasingDirection.In, 0 , false , 0 ), { CFrame = humRP.CFrame * CFrame.new( 0 , 0 ,- 50 ) } ) |
39 | React.Stopped:Connect( function () |
44 | Sound.Ended:Connect( function () |
47 | for _, i in pairs (char:GetChildren()) do |
48 | if i:IsA( "BasePart" ) then |
49 | i.Touched:Connect( function (hit) |
50 | if hasHit = = false and tweenActive = = true then |
52 | if hit.Parent:FindFirstChild( "Humanoid" ) then |
53 | print ( "found character!" ) |
54 | local hitHum = hit.Parent.Humanoid |
55 | local hitHRP = hit.Parent:FindFirstChild( "HumanoidRootPart" ) |
56 | local UppercutPlr = hum:LoadAnimation(Animations.UppercutPlr) |
57 | local UppercutEnemy = hitHum:LoadAnimation(Animations.UppercutEnemy) |
58 | local enemyPlr = game.Players:GetPlayerFromCharacter(hit.Parent) |
62 | hitHum:TakeDamage(EDamage) |
64 | DisableAttack:FireClient(enemyPlr) |
67 | humRP.CFrame = hitHRP.CFrame * CFrame.new( 0 , 0 ,- 3 ) |
68 | humRP.CFrame = CFrame.new(humRP.Position, hitHRP.Position) |
70 | hitHRP.Anchored = true |
71 | UppercutPlr.Stopped:Connect( function () |
73 | humRP.Anchored = false |
74 | hitHRP.Anchored = false |
75 | EventE:FireClient(player) |
76 | EnableAttack:FireClient(enemyPlr) |
84 | tween.Completed:Connect( function () |
85 | if hasHit = = false then |
89 | EnableAttack:FireClient(player) |
The script is in ServerScriptService, and the script is a (very obvious) server script.
The problem is since I cant get the enemy player, I only have the player.
This results in MORE problems including the player being unable to use a move after used.
It's weird.
Any help would be appreciated!
For more detail in what any of this stuff is, please ask, and I can kindly provide.
Thank you for listening.
I hope I can count on you!