I want to create a swarm monster than leaving behind a poison puddle after it walk for a few step. the puddle will slowly getting smaller and eventually delete itself
(Some thing like this)
Where do I start if I want to create some thing like this? I know how to tween the puddle size but I don’t know how to spawn the puddle as the monster walk forward
I guess you can check if the character is touching the ground and if it is, then spawn a puddle at the feet. You can also use magnitude to calculate the speed of the character. that may also help.
local char = script.Parent
local Humanoid = char.Humanoid
local RunService = game:GetService("RunService")
local function IsMoving()
if Humanoid.MoveDirection.Magnitude == 0 then
return
elseif Humanoid.MoveDirection.Magnitude > 0 then
local block = Instance.new("Part", workspace)
block.Position = char.HumanoidRootPart.Position
end
end
while task.wait(3) do
Humanoid:MoveTo(Vector3.new(math.random(1,20),math.random(1,20),math.random(1,20)))
end
RunService.Stepped:Connect(IsMoving)
I found this code that can be use to check if player is moving or not but when I tried to imprement it onto the npc it does nothing
the npc does not spawn any brock behide after it moved and when I use print for debug it return nothing
this code does nothing because the while task.wait loop yields the code making it unreachable for the stepped event to activate. so the isMoving function never gets called in the first place
if you delete this part;
it should be working since all it does is move the player to random positions
and just to let you know in the isMoving function its better that you add a cooldown before it spawns