Rocks Module - Useful for Anime Games Skill Effects

Thanks for the update, along with your hard work!

Any update on the new module??

It pleases me to take the honor to do the job, I made the rocks debris to be creatable on walls.

IT TOOK ME 2 DAYS TO DO THIS.

Here’s is the new module:

A new approch of calling the module must be followed:

  • The new arguments:

  • Normals added

So you have to use raycast
Example:


Sorry its white themed

As you can see there must be surface normals for it to face the surface’s direction.

I hope I provided a hand of help :smiley:

  • EDIT:
    New feature added (Fade in, It used to js appear suddenly)
7 Likes

Model is Privated, Not sure why

oh really? mb try it now please

Thank you for taking the initiative on this project!
I started working out of Roblox some months ago so I have not been able to contribute in Roblox.
I’ll pin your module to the main topic once I get home.

2 Likes

Oh i see well i wanna take the chance to ask you which one is funnier? roblox studio or the other thing

It depends on what I need to make so usually I have fun on both, but I’m more familiar with Lua.
For context, I work with C# in a local company, but I’ve had never done any programming language other than Lua before that, so I’m fairly new to it (started working and learning it on Feb of this year).

Tldr: I prefer working with Lua due to my familiarity with it, but I don’t find much difference between them in terms of enjoyment.

3 Likes

Hi, bit late to this discussion but I have noticed that the module doesnt support Terrain, when it lands on terrain it just makes the color and material to default so I have gone ahead and made it support:

local Rocks = {}

local TS = game:GetService("TweenService")
local RS = game:GetService("ReplicatedStorage")
local PS = game:GetService("PhysicsService")
local RunService = game:GetService("RunService")

local Modules = RS.Modules
local partCacheMod = require(Modules.PartCache)

local cacheFolder
if not workspace:FindFirstChild("Debris") then
	cacheFolder = Instance.new("Folder")
	cacheFolder.Name = "Debris"
	cacheFolder.Parent = workspace
else
	cacheFolder = workspace.Debris
end

local partCache = partCacheMod.new(Instance.new("Part"), 1000, cacheFolder)

function Rocks.Ground(Pos, Distance, Size, filter, MaxRocks, Ice, despawnTime)
	local random = Random.new()
	
	local angle = 30
	local otherAngle = 360/MaxRocks
	local params = RaycastParams.new()
	params.FilterType = Enum.RaycastFilterType.Exclude
	params.FilterDescendantsInstances = filter or {game.Players.LocalPlayer.Character, cacheFolder}
	local size
	size = Size or Vector3.new(2, 2, 2)
	local pos = Pos
	despawnTime = despawnTime or 3
	local function GetGroundInfo(ray) --NEW
		local material = ray.Material
		local color

		if ray.Instance == workspace.Terrain then
			color = workspace.Terrain:GetMaterialColor(material)
		else
			color = ray.Instance.Color
		end

		return material, color
	end
	local function OuterRocksLoop ()
		for i = 1, MaxRocks do
			local cf = CFrame.new(Pos)
			local newCF = cf * CFrame.fromEulerAnglesXYZ(0, math.rad(angle), 0) * CFrame.new(Distance/2 + Distance/2.7, 10, 0)
			local ray = workspace:Raycast(newCF.Position, Vector3.new(0, -20, 0), params)
			angle += otherAngle
			if ray then
				local part = partCache:GetPart()
				local hoof = partCache:GetPart()
				
				part.CFrame = CFrame.new(ray.Position - Vector3.new(0, 0.5, 0), Pos) * CFrame.fromEulerAnglesXYZ(random:NextNumber(-.25, .5), random:NextNumber(-.25, .25), random:NextNumber(-.25, .25))
				part.Size = Vector3.new(size.X * 1.3, size.Y/1.4, size.Z * 1.3) * random:NextNumber(1, 1.5)
				
				hoof.Size = Vector3.new(part.Size.X * 1.01, part.Size.Y * 0.25, part.Size.Z * 1.01)
				hoof.CFrame = part.CFrame * CFrame.new(0, part.Size.Y/2 - hoof.Size.Y / 2.1, 0)
				
				part.Parent = cacheFolder
				hoof.Parent = cacheFolder
				
				local groundMaterial, groundColor = GetGroundInfo(ray)

				if groundMaterial == Enum.Material.Concrete
					or groundMaterial == Enum.Material.Air
					or groundMaterial == Enum.Material.Wood
					or groundMaterial == Enum.Material.Neon
					or groundMaterial == Enum.Material.WoodPlanks then

					part.Material = groundMaterial
					hoof.Material = groundMaterial
				else
					part.Material = Enum.Material.Concrete
					hoof.Material = groundMaterial
				end

				part.BrickColor = BrickColor.new("Dark grey")
				part.Anchored = true
				part.CanTouch = false
				part.CanCollide = false

				hoof.BrickColor = BrickColor.new(groundColor)
				hoof.Anchored = true
				hoof.CanTouch = false
				hoof.CanCollide = false

				if Ice then
					part.BrickColor = BrickColor.new("Pastel light blue")
					hoof.BrickColor = BrickColor.new("Lily white")
					part.Material = Enum.Material.Ice
					hoof.Material = Enum.Material.Sand
				end
				
				task.delay(despawnTime, function()
					TS:Create(part,TweenInfo.new(0.6, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut),{Size = Vector3.new(.01, .01, .01)}):Play()
					TS:Create(hoof,TweenInfo.new(0.6, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut),{Size = Vector3.new(.01, .01, .01), CFrame = part.CFrame * CFrame.new(0, part.Size.Y/2 - part.Size.Y / 2.1, 0)}):Play()
					
					task.delay(0.6, function()
						partCache:ReturnPart(part)
						partCache:ReturnPart(hoof)
					end)
				end)
			end		
		end
	end

	local function InnerRocksLoop ()
		for i = 1, MaxRocks do
			local cf = CFrame.new(Pos)
			local newCF = cf * CFrame.fromEulerAnglesXYZ(0, math.rad(angle), 0) * CFrame.new(Distance/2 + Distance/10, 10, 0)
			local ray = game.Workspace:Raycast(newCF.Position, Vector3.new(0, -20, 0), params)
			angle += otherAngle
			if ray then
				local part = partCache:GetPart()
				local hoof = partCache:GetPart()

				part.CFrame = CFrame.new(ray.Position - Vector3.new(0, size.Y * 0.4, 0), Pos) * CFrame.fromEulerAnglesXYZ(random:NextNumber(-1,-0.3),random:NextNumber(-0.15,0.15),random:NextNumber(-.15,.15))
				part.Size = Vector3.new(size.X * 1.3, size.Y * 0.7, size.Z * 1.3) * random:NextNumber(1, 1.5)

				hoof.Size = Vector3.new(part.Size.X * 1.01, part.Size.Y * 0.25, part.Size.Z * 1.01)
				hoof.CFrame = part.CFrame * CFrame.new(0, part.Size.Y/2 - hoof.Size.Y / 2.1, 0)

				part.Parent = cacheFolder
				hoof.Parent = cacheFolder

				local groundMaterial, groundColor = GetGroundInfo(ray)

				if groundMaterial == Enum.Material.Concrete
					or groundMaterial == Enum.Material.Air
					or groundMaterial == Enum.Material.Wood
					or groundMaterial == Enum.Material.Neon
					or groundMaterial == Enum.Material.WoodPlanks then

					part.Material = groundMaterial
					hoof.Material = groundMaterial
				else
					part.Material = Enum.Material.Concrete
					hoof.Material = groundMaterial
				end

				part.BrickColor = BrickColor.new("Dark grey")
				part.Anchored = true
				part.CanTouch = false
				part.CanCollide = false

				hoof.BrickColor = BrickColor.new(groundColor)
				hoof.Anchored = true
				hoof.CanTouch = false
				hoof.CanCollide = false

				if Ice then
					part.BrickColor = BrickColor.new("Pastel light blue")
					hoof.BrickColor = BrickColor.new("Lily white")
					part.Material = Enum.Material.Ice
					hoof.Material = Enum.Material.Sand
				end

				task.delay(despawnTime, function()
					TS:Create(part,TweenInfo.new(0.6, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut),{Size = Vector3.new(.01, .01, .01)}):Play()
					TS:Create(hoof,TweenInfo.new(0.6, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut),{Size = Vector3.new(.01, .01, .01), CFrame = part.CFrame * CFrame.new(0, part.Size.Y/2 - part.Size.Y / 2.1, 0)}):Play()

					task.delay(0.6, function()
						partCache:ReturnPart(part)
						partCache:ReturnPart(hoof)
					end)
				end)
			end		
		end
	end
	InnerRocksLoop()
	OuterRocksLoop()
end

return Rocks