-
What do you want to achieve?
I was trying to make an earth skill just to practice a bit and mess around with friends in a place. -
What is the issue?
However, I noticed that in case of two players attacking at the same time (apparently) the damage of one’s skill will be absurd and kill a player even having (for example) 900 health when the damage of the skill is 8. -
What solutions have you tried so far?
Well I don’t seem to find anyone with similar problems in the devforum, I guessed that it was .Touched (originally i used .Touched for the skill) and then changed to magnitude but that didnt quiet seem to help.
–// Client Script
local player = game.Players.LocalPlayer
repeat wait() until player.Character
local Cooldown = false
local camera = workspace.CurrentCamera
local CameraShaker = require(game:GetService('ReplicatedStorage').Modules:WaitForChild("CameraShaker"));
local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCf)
camera.CFrame = camera.CFrame * shakeCf
end)
local tool = script.Parent
tool.Activated:connect(function()
if Cooldown == true then
return
else
camShake:Start()
camShake:Shake(CameraShaker.Presets.Explosion)
spawn(function()
wait(3)
camShake:Stop()
end)
tool.Replication:FireServer()
Cooldown = true
wait(9)
Cooldown = false
end
end)
–// Server Script
local rock = game.ReplicatedStorage.Assets.EarthLift.Effects.Rock
local TweenInformation = TweenInfo.new(0.35, Enum.EasingStyle.Quint, Enum.EasingDirection.InOut)
local TweenS = game:GetService("TweenService")
local Ragdoll = require(game.ReplicatedStorage.Modules.Ragdoll)
local tool = script.Parent.Parent.Parent
script.Parent.Replication.OnServerEvent:Connect(function(plr)
if plr.Name == script.Parent.Parent.Name then
local Character = plr.Character
local rocksToCreate = math.random(5,7)
local distance = rock.Size.X * rocksToCreate
local startPos = plr.Character.HumanoidRootPart.Position
local direction = plr.Character.HumanoidRootPart.CFrame.LookVector * Vector3.new(1, 0, 1)
local AnimationTrack = game.ReplicatedStorage.Assets.EarthLift.Animations.Cast
local Animation = Character.Humanoid:LoadAnimation(AnimationTrack)
Animation:Play()
Character.Humanoid.WalkSpeed = 0
Character.Humanoid.JumpHeight = 0
spawn(function()
wait(0.75)
Character.Humanoid.WalkSpeed = 16
Character.Humanoid.JumpHeight = 7.2
end)
wait(0.3)
for i = 1, rocksToCreate, 1 do
local newRock = rock:Clone()
local rockPos = startPos + (direction * rock.Size.X * i)
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {newRock}
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local ray = Ray.new(rockPos, rockPos - Vector3.new(0, 1000, 0), raycastParams)
local part, pos = workspace:FindPartOnRay(ray, newRock)
local y = pos.Y + newRock.Size.Y / 4
rockPos = Vector3.new(rockPos.X, y, rockPos.Z)
local Sound = game:GetService("ReplicatedStorage").Assets.EarthLift.Sounds.EarthShake:Clone()
Sound.Parent = newRock
Sound.Volume = 0.5
Sound:Play()
newRock.Position = rockPos - Vector3.new(0, rock.Size.Y, 0)
newRock.Orientation = Vector3.new(math.random(-10, 10), math.random(0, 360), math.random(-10, 10))
local Appear = TweenS:Create(newRock, TweenInformation, {Position = rockPos})
Appear:Play()
for i,v in pairs(game.Workspace:GetChildren()) do
if v:IsA("Model") and v:FindFirstChild("Humanoid") then
if v ~= Character then
if (newRock.Position - v.HumanoidRootPart.Position).Magnitude <= 7.5 then
v.Humanoid:TakeDamage(8)
local velo = Instance.new("BodyVelocity",v.HumanoidRootPart)
velo.MaxForce = Vector3.new(10000000,10000000,1000000)
velo.P = 1000000
local ConvictHRP = newRock
local VictimHRP = v.HumanoidRootPart
local Angle = ((VictimHRP.Position - ConvictHRP.Position) * Vector3.new(10,0,10)).Unit * 50 + Vector3.new(0,25,0)
velo.Velocity = Angle
spawn(function()
wait(0.1)
velo:Destroy()
end)
Ragdoll:ragdoll(v,true)
spawn(function()
wait(1.3)
Ragdoll:ragdoll(v,false)
end)
local NewFX = game.ReplicatedStorage.Assets.EarthLift.Effects.Hit:Clone()
NewFX.Parent = v.HumanoidRootPart
NewFX:Emit(1)
game.Debris:AddItem(NewFX,0.6)
local Sound = game:GetService("ReplicatedStorage").Assets.EarthLift.Sounds.Hit:Clone()
Sound.Parent = v.HumanoidRootPart
Sound.Volume = 0.05
Sound:Play()
end
end
end
end
newRock.Parent = workspace
wait(0.3)
for i,v in pairs(game.Workspace:GetChildren()) do
if v:IsA("Model") and v:FindFirstChild("Humanoid") then
if v ~= Character then
if (newRock.Position - v.HumanoidRootPart.Position).Magnitude <= 7.5 then
v.Humanoid:TakeDamage(8)
local velo = Instance.new("BodyVelocity",v.HumanoidRootPart)
velo.MaxForce = Vector3.new(10000000,10000000,1000000)
velo.P = 1000000
local ConvictHRP = newRock
local VictimHRP = v.HumanoidRootPart
local Angle = ((VictimHRP.Position - ConvictHRP.Position) * Vector3.new(10,0,10)).Unit * 50 + Vector3.new(0,25,0)
velo.Velocity = Angle
spawn(function()
wait(0.1)
velo:Destroy()
end)
Ragdoll:ragdoll(v,true)
spawn(function()
wait(1.3)
Ragdoll:ragdoll(v,false)
end)
local NewFX = game.ReplicatedStorage.Assets.EarthLift.Effects.Hit:Clone()
NewFX.Parent = v.HumanoidRootPart
NewFX:Emit(1)
game.Debris:AddItem(NewFX,0.6)
local Sound = game:GetService("ReplicatedStorage").Assets.EarthLift.Sounds.Hit:Clone()
Sound.Parent = v.HumanoidRootPart
Sound.Volume = 0.05
Sound:Play()
end
end
end
end
local Disappear = TweenS:Create(newRock, TweenInformation, {Position = rockPos - Vector3.new(0, rock.Size.Y, 0)})
Disappear:Play()
game:GetService("Debris"):AddItem(newRock, 0.35)
end
else
return
end
end)
Guess hope you can help me.
Note: The error can’t be magnitude, .Touched, Raycast or any hitbox method that i’ve tried I’m 99% sure it’s not that.