So right now I’m making a combat game where I put down a script for the combat, but when testing it with another player, only one person can use the combat, I don’t know what is wrong with the script currently but I need help on making the combat useable for everyone
local ScreenRemote = game.ReplicatedStorage:WaitForChild("ScreenR")
local TweenService = game:GetService("TweenService")
local Anims = script:WaitForChild("Anims")
local Sounds = script:WaitForChild("Sounds")
local FX = script:WaitForChild("FX")
local Debounce = false
Remote.OnServerEvent:Connect(function(Player,Action,Combo)
local Char = Player.Character
local Hum = Char:WaitForChild("Humanoid")
local HumRP = Char:WaitForChild("HumanoidRootPart")
local CurrentWalkSpeed = Hum.WalkSpeed
if Char:FindFirstChild("Disabled") == nil and Debounce == false then
Debounce = true
delay (0.39,function()
Debounce = false
end)
Hum.WalkSpeed = 10
local RightArm = Char:WaitForChild("Right Arm")
local LeftArm = Char:WaitForChild("Left Arm")
local RightLeg = Char:WaitForChild("Right Leg")
local Combo1Loaded = Hum:LoadAnimation(Anims.Combo1)
local Combo2Loaded = Hum:LoadAnimation(Anims.Combo2)
local Combo3Loaded = Hum:LoadAnimation(Anims.Combo3)
local Combo4Loaded = Hum:LoadAnimation(Anims.Combo4)
local InsertDisabled = function(Target,Time)
local Disabled = Instance.new("BoolValue",Target)
Disabled.Name = Player.Name.."Disabled"
game.Debris:AddItem(Disabled,Time)
end
local Hiteffect = function(Target)
local HiteffectFX = FX.Hiteffect:Clone()
HiteffectFX.Parent = Target
HiteffectFX:Emit(1)
game.Debris:AddItem(HiteffectFX,1)
if Combo == 4 then
local Sound = Sounds.ImpactLast:Clone()
Sound.Parent = Target
Sound:Play()
game.Debris:AddItem(Sound,1)
else
local Sound = Sounds.ImpactSound:Clone()
Sound.Parent = Target
Sound.PlaybackSpeed = math.random(90,110)/100
Sound:Play()
game.Debris:AddItem(Sound,1)
end
local Sound = Sounds.ImpactSound:Clone()
Sound.Parent = Target
Sound.PlaybackSpeed = math.random(70,110)/100
Sound:Play()
game.Debris:AddItem(Sound,1)
local Hiteffect2 = FX.Hiteffect3:Clone()
Hiteffect2.Parent = Target
Hiteffect2.CFrame = Target.CFrame
game.Debris:AddItem(Hiteffect2,0.4)
local goal = {}
goal.Transparency = 1
goal.Size = Vector3.new(6.626, 4.102, 5.24)
local Info = TweenInfo.new(0.4,Enum.EasingStyle.Quad)
local Tween = TweenService:Create(Hiteffect2,Info,goal)
Tween:Play()
Target.Orientation = HumRP.Orientation - Vector3.new(0,180,0)
end
spawn(function()
if Combo == 4 then
delay(0.8,function()
Remote:FireClient(Player)
Hum.WalkSpeed = CurrentWalkSpeed
end)
else
delay(0.4,function()
Remote:FireClient(Player)
Hum.WalkSpeed = CurrentWalkSpeed
end)
end
end)
delay(0.2,function()
local Folder = Instance.new("Folder",workspace)
Folder.Name = Player.Name.."Hitbox"
game.Debris:AddItem(Folder,0.65)
if Combo == 1 then
Combo1Loaded:Play()
elseif Combo == 2 then
Combo2Loaded:Play()
elseif Combo == 3 then
Combo3Loaded:Play()
elseif Combo == 4 then
Combo4Loaded:Play()
end
if Combo == 1 then
local Hitbox = script:WaitForChild("Hitbox"):Clone()
Hitbox.Parent = Folder
local Weld = Instance.new("Weld",RightArm)
Weld.Part0 = RightArm
Weld.Part1 = Hitbox
Weld.C0 = Hitbox.CFrame:inverse() * RightArm.CFrame
Hitbox.Touched:Connect(function(Hit)
if Hit.Parent ~= Player.Name then
local GetHum = Hit.Parent:FindFirstChild("Humanoid")
if GetHum then
Folder:Destroy()
GetHum:TakeDamage(10)
local Combo1Hit = GetHum:LoadAnimation(Anims.HitFirst)
Combo1Hit:Play()
local BV = Instance.new("BodyVelocity",Hit.Parent.HumanoidRootPart)
BV.MaxForce = Vector3.new(10000,10000,10000)
BV.Velocity = HumRP.CFrame.lookVector * 5
game.Debris:AddItem(BV,0.4)
ScreenRemote:FireClient(Player)
local DmgIndicator = FX.DamageIndicator:Clone()
DmgIndicator.Parent = Hit.Parent
DmgIndicator.Damage.Text = "10!"
game.Debris:AddItem(DmgIndicator,0.8)
local goal = {}
goal.StudsOffset = Vector3.new(0,4,0)
local Info = TweenInfo.new(0.5,Enum.EasingStyle.Quad)
local Tween = TweenService:Create(DmgIndicator,Info,goal)
Tween:Play()
InsertDisabled(Hit.Parent,0.8)
Hiteffect(Hit.Parent.HumanoidRootPart)
end
end
end)
elseif Combo == 2 then
local Hitbox = script:WaitForChild("Hitbox"):Clone()
Hitbox.Parent = Folder
local Weld = Instance.new("Weld",LeftArm)
Weld.Part0 = LeftArm
Weld.Part1 = Hitbox
Weld.C0 = Hitbox.CFrame:inverse() * LeftArm.CFrame
Hitbox.Touched:Connect(function(Hit)
if Hit.Parent ~= Player.Name then
local GetHum = Hit.Parent:FindFirstChild("Humanoid")
if GetHum then
Folder:Destroy()
GetHum:TakeDamage(10)
local Combo2Hit = GetHum:LoadAnimation(Anims.HitSecond)
Combo2Hit:Play()
local BV = Instance.new("BodyVelocity",Hit.Parent.HumanoidRootPart)
BV.MaxForce = Vector3.new(10000,10000,10000)
BV.Velocity = HumRP.CFrame.lookVector * 5
game.Debris:AddItem(BV,0.4)
ScreenRemote:FireClient(Player)
local DmgIndicator = FX.DamageIndicator:Clone()
DmgIndicator.Parent = Hit.Parent
DmgIndicator.Damage.Text = "10!"
game.Debris:AddItem(DmgIndicator,0.8)
local goal = {}
goal.StudsOffset = Vector3.new(0,4,0)
local Info = TweenInfo.new(0.5,Enum.EasingStyle.Quad)
local Tween = TweenService:Create(DmgIndicator,Info,goal)
Tween:Play()
InsertDisabled(Hit.Parent,0.8)
Hiteffect(Hit.Parent.HumanoidRootPart)
end
end
end)
elseif Combo == 3 then
local Hitbox = script:WaitForChild("Hitbox"):Clone()
Hitbox.Parent = Folder
local Weld = Instance.new("Weld",RightLeg)
Weld.Part0 = RightLeg
Weld.Part1 = Hitbox
Weld.C0 = Hitbox.CFrame:inverse() * RightLeg.CFrame
Hitbox.Touched:Connect(function(Hit)
if Hit.Parent ~= Player.Name then
local GetHum = Hit.Parent:FindFirstChild("Humanoid")
if GetHum then
Folder:Destroy()
GetHum:TakeDamage(10)
local Combo3Hit = GetHum:LoadAnimation(Anims.HitThird)
Combo3Hit:Play()
local BV = Instance.new("BodyVelocity",Hit.Parent.HumanoidRootPart)
BV.MaxForce = Vector3.new(10000,10000,10000)
BV.Velocity = HumRP.CFrame.lookVector * 5
game.Debris:AddItem(BV,0.4)
ScreenRemote:FireClient(Player)
local DmgIndicator = FX.DamageIndicator:Clone()
DmgIndicator.Parent = Hit.Parent
DmgIndicator.Damage.Text = "10!"
game.Debris:AddItem(DmgIndicator,0.8)
local goal = {}
goal.StudsOffset = Vector3.new(0,4,0)
local Info = TweenInfo.new(0.5,Enum.EasingStyle.Quad)
local Tween = TweenService:Create(DmgIndicator,Info,goal)
Tween:Play()
InsertDisabled(Hit.Parent,0.8)
Hiteffect(Hit.Parent.HumanoidRootPart)
end
end
end)
elseif Combo == 4 then
local Hitbox = script:WaitForChild("Hitbox"):Clone()
Hitbox.Parent = Folder
local Weld = Instance.new("Weld",LeftArm)
Weld.Part0 = LeftArm
Weld.Part1 = Hitbox
Weld.C0 = Hitbox.CFrame:inverse() * LeftArm.CFrame
Hitbox.Touched:Connect(function(Hit)
if Hit.Parent ~= Player.Name then
local GetHum = Hit.Parent:FindFirstChild("Humanoid")
if GetHum then
Folder:Destroy()
GetHum:TakeDamage(20)
local Combo4Hit = GetHum:LoadAnimation(Anims.HitFourth)
Combo4Hit:Play()
local BV = Instance.new("BodyVelocity",Hit.Parent.HumanoidRootPart)
BV.MaxForce = Vector3.new(10000,10000,10000)
BV.Velocity = HumRP.CFrame.lookVector * 30
game.Debris:AddItem(BV,0.6)
ScreenRemote:FireClient(Player,"Last")
local DmgIndicator = FX.DamageIndicator:Clone()
DmgIndicator.Parent = Hit.Parent
DmgIndicator.Damage.Text = "20!"
game.Debris:AddItem(DmgIndicator,0.8)
local goal = {}
goal.StudsOffset = Vector3.new(0,4,0)
local Info = TweenInfo.new(0.5,Enum.EasingStyle.Quad)
local Tween = TweenService:Create(DmgIndicator,Info,goal)
Tween:Play()
InsertDisabled(Hit.Parent,0.8)
Hiteffect(Hit.Parent.HumanoidRootPart)
end
end
end)
end
end)
end
end)
That is the script, I would appreciate if someone can fix my script for me thanks