So I’m trying to make a crucifix like tool, and it won’t drag the player into the ground, it freezes them, but doesn’t drag them into the ground.
local replicatedStorage = game:GetService("ReplicatedStorage")
local crucifixEvent = replicatedStorage:WaitForChild("CrucifixEvent")
local function onCrucifixUse(player, enemy)
if enemy and enemy:FindFirstChild("Humanoid") then
local humanoid = enemy:FindFirstChild("Humanoid")
if humanoid then
-- Create a visual effect
local iceBlock = Instance.new("Part")
iceBlock.Size = enemy:GetExtentsSize()
iceBlock.CFrame = enemy:GetModelCFrame()
iceBlock.Anchored = true
iceBlock.Transparency = 0.5
iceBlock.BrickColor = BrickColor.new("Light blue")
iceBlock.Material = Enum.Material.Ice
iceBlock.Parent = workspace
-- Attach the ice block to the enemy
iceBlock.CFrame = enemy.PrimaryPart.CFrame
for _, part in pairs(enemy:GetChildren()) do
if part:IsA("BasePart") then
local weld = Instance.new("Weld")
weld.Part0 = part
weld.Part1 = iceBlock
weld.C0 = part.CFrame:inverse() * iceBlock.CFrame
weld.Parent = part
end
end
-- Gradually drag the enemy into the ground
local duration = 5 -- Duration of the dragging effect
local steps = 100 -- Number of steps in the dragging effect
local stepDuration = duration / steps
local initialPosition = enemy.PrimaryPart.Position
local targetPosition = initialPosition - Vector3.new(0, 10, 0) -- Drag down by 10 studs
for i = 1, steps do
local progress = i / steps
local newPosition = initialPosition:Lerp(targetPosition, progress)
print("Dragging enemy to position:", newPosition)
enemy:SetPrimaryPartCFrame(CFrame.new(newPosition))
wait(stepDuration)
end
-- Remove the ice block after dragging effect
iceBlock:Destroy()
end
end
end
crucifixEvent.OnServerEvent:Connect(onCrucifixUse)