Don't Know How To Add Crater Effect

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

1 Like

You only have one argument in your .Create function, when it should have 3 (which are radius, position, and rocksize).

Code:

-- When a ball touch something
c.Touched:Connect(function(hit)
	local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid")
	
	if humanoid then
		humanoid:TakeDamage(25)
		CraterCreator.Create(20, c.Position, 20)
	end
end)

Change the values if needed. You also don’t need the semi colons.

3 Likes

You’re right about the argument on the .Create function (and the semi colons), Thanks alot!

2 Likes

No problem. Have a good day!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.