Recently I made a game with a boulder projectile that is designed to be heavy, but I don’t know how to add the crater module into the projectile script
So I used this Crater Module for the effect: Crater Module for creating craters
here is my script on the projectile:
script.Parent.Activated:Connect(function()
if not db then
db = true
-- Ball throw
local t = 1;
local char = player.Character;
local hrp = char.HumanoidRootPart;
local bball = script.Parent:WaitForChild("Handle");
local g = Vector3.new(0, -game.Workspace.Gravity, 0);
local x0 = hrp.CFrame * Vector3.new(0, 2, -2)
-- calculate the v0 needed to reach mouse.Hit.p
local v0 = (mousePos - x0 - 0.5*g*t*t)/t;
-- have the ball travel that path
local c = Instance.new("Part" , workspace);
c.Shape = "Ball";
c.Material = Enum.Material.Limestone;
c.Color = Color3.fromRGB(98, 99, 102);
c.Size = Vector3.new(2,2,2);
c.Velocity = v0;
c.CFrame = CFrame.new(x0);
c.CanCollide = true;
c.Parent = game.Workspace;
-- When a ball touch something
c.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid");
if humanoid then
humanoid:TakeDamage(25);
CraterCreator.Create(c.Touched)
end
end)
I would love to know how to fix it and add the module effect