Can you modify this roblox module to do a few things? 1: Change it so the rocks are…
- User
Can you modify this roblox module to do a few things?
1: Change it so the rocks are basically duplicated, but they lower the height, increase the x and z by a tiny amount, and then move it up to the top of the original rock part for each rock, that way there is a bit of a ground effect to it (See image 1)
2: The rocks instead of just tweening the size, they tween the rotation as well, basically right now they tween the size while already rotated, but what it should do is keep the rotation flat, 0, 0, 0 (but still rotated around origin), but tween to match the rotation it should be.
3: The position of the rocks should do the same as change 2, the position should be a little bit lower how they are now (like quarter of a stud) when they first spawn, then tween to go up.
3: The rocks should delay a tiny amount the further away they are from the origin, the closer, the faster they appear, the further, the longer they appear.
4: Add a new parameter to change the thickness of the rocks, this changes the amount of outer rocks that expand in size the further they are from the origin, right now there are 2 lines, inner and outer, this parameter changes the amount of outer rocks that go further out and are bigger.
Here is the module:
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.GameModules 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 SpawnRockAnimation(part, hoof) -- Initial tiny size before animation starts part.Size = Vector3.new(0.1, 0.1, 0.1) hoof.Size = Vector3.new(0.1, 0.025, 0.1) -- Spawning animation setup local spawnTween = TS:Create(part, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = size * random:NextNumber(1, 1.5), CFrame = part.CFrame}) local hoofSpawnTween = TS:Create(hoof, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = Vector3.new(size.X * 1.01, size.Y * 0.25, size.Z * 1.01), CFrame = hoof.CFrame}) -- Play the spawn animation spawnTween:Play() hoofSpawnTween:Play() 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)) hoof.CFrame = part.CFrame * CFrame.new(0, part.Size.Y / 2 - hoof.Size.Y / 2.1, 0) SpawnRockAnimation(part, hoof) part.Parent = cacheFolder hoof.Parent = cacheFolder part.Material = ray.Instance.Material hoof.Material = ray.Instance.Material part.BrickColor = ray.Instance.BrickColor hoof.BrickColor = ray.Instance.BrickColor part.Anchored = true part.CanTouch = false part.CanCollide = false hoof.Anchored = true hoof.CanTouch = false hoof.CanCollide = false if Ice then part.Material = Enum.Material.Ice hoof.Material = Enum.Material.Sand part.BrickColor = BrickColor.new("Pastel light blue") hoof.BrickColor = BrickColor.new("Lily white") 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 = 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)) hoof.CFrame = part.CFrame * CFrame.new(0, part.Size.Y / 2 - hoof.Size.Y / 2.1, 0) SpawnRockAnimation(part, hoof) part.Parent = cacheFolder hoof.Parent = cacheFolder part.Material = ray.Instance.Material hoof.Material = ray.Instance.Material part.BrickColor = ray.Instance.BrickColor hoof.BrickColor = ray.Instance.BrickColor part.Anchored = true part.CanTouch = false part.CanCollide = false hoof.Anchored = true hoof.CanTouch = false hoof.CanCollide = false if Ice then part.Material = Enum.Material.Ice hoof.Material = Enum.Material.Sand part.BrickColor = BrickColor.new("Pastel light blue") hoof.BrickColor = BrickColor.new("Lily white") 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 - Assistant