local remote = script.Parent.Parent.RemoteEvent
local replicated = game:GetService("ReplicatedStorage")
local Modules = game.ReplicatedStorage.Modules
local misc = require(Modules.Misc)
local holdremote = script.Parent.Parent.Detectedhold
holdremote.OnServerEvent:Connect(function(player, char)
local hrp = char:WaitForChild("HumanoidRootPart")
local mouse = player:GetMouse()
while true do
wait()
local lookVector = (mouse.Hit.Position - hrp.Position).Unit
local lookRotation = CFrame.new(Vector3.new(), lookVector)
hrp.CFrame = CFrame.new(hrp.Position) * lookRotation
end
end)
remote.OnServerEvent:Connect(function(player, char, tool)
print("Server Recieved Call From Client . . . Initiating")
local mouse = player:GetMouse()
local explosion = replicated.FX.template2:Clone()
local hrp = char:WaitForChild("HumanoidRootPart")
hrp.Anchored = true
explosion.Parent = workspace
explosion.CFrame = CFrame.new((hrp.CFrame*CFrame.new(0, 0, 0)).Position)
local hitList = {}
explosion.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local hitChar = hit.Parent
if hitChar == char or hitList[hitChar] then return end
hitList[hitChar] = true
hitChar.HumanoidRootPart.CFrame = CFrame.lookAt(hitChar.HumanoidRootPart.Position, explosion.Position) * CFrame.Angles(0, math.pi, 0)
local Damage = 50
hitChar.Humanoid:TakeDamage(Damage)
misc.StrongKnockback(hit.Parent.HumanoidRootPart, 35, 45, 0.15, explosion)
end
end)
wait(2)
hrp.Anchored = false
explosion:Destroy()
print("Operation Finished")
end)