#Help with a roblox Tower Defense Game
1 messages · Page 1 of 1 (latest)
local distance = (mobToSpawn.HumanoidRootPart.Position - waypoints[i].Position).Magnitude
local speed = distance / humanoid.WalkSpeed
local positionTween = tweenService:Create(mobToSpawn.HumanoidRootPart, TweenInfo.new(speed, Enum.EasingStyle.Linear), {Position = waypoints[i].Position})
positionTween:Play()
positionTween.Completed:Wait()
I tween the position of the HumanoidRootPart directly to the waypoint, which causes the enemies to float above the path
Yes
try use position like this
local distance = (mobToSpawn.HumanoidRootPart.Position - waypoints[i].Position).Magnitude
local speed = distance / humanoid.WalkSpeed
local cframe = CFrame.new(waypoints[i].Position)
local positionTween = tweenService:Create(mobToSpawn.HumanoidRootPart, TweenInfo.new(speed, Enum.EasingStyle.Linear), {CFrame = cframe})
positionTween:Play()
positionTween.Completed:Wait()
I changed that, but the problem is the enemies floating like this
I think its because the waypoint is above the path, but if i move the waypoint down other enemies with different sizes will stop working
I've tried using alignPosition but its too confusing for me
** You are now Level 2! **
local distance = (mobToSpawn.HumanoidRootPart.Position - waypoints[i].Position).Magnitude
local speed = distance / humanoid.WalkSpeed
local yOffset = mobToSpawn.HumanoidRootPart.Size.Y / 2
local cframe = CFrame.new(waypoints[i].Position + Vector3.new(0, yOffset, 0))
local positionTween = tweenService:Create(mobToSpawn.HumanoidRootPart, TweenInfo.new(speed, Enum.EasingStyle.Linear), {CFrame = cframe})
positionTween:Play()
positionTween.Completed:Wait()
yOffset
not any other offset
use :Lerp()
CFrame:Lerp(math.clamp( ... ), 0, 1)
load animation separately
idk what he talk about, but he a sure cool guy
theyre floating higher
yea
ik
you need math 5 class and logic to do this
ok Mr.Math
I think Yoffest works
kool
lemme check with other enemies rq
make offset different for enemies sizes I guess
bros writing a math formula now
I bet
bros Eistein
he writing essay
he write a new math love story
dont worry
bro's doing all his math homework right now in this forum 100%
no
Yes
he writing Newton's Gravity Formula
he's reforming all his formulas
Bro is angry
I think we gonna see a new reform in math history right now
wtf this dude writing
@limpid rover can u close this
forum?
think guy is writing his life plans here
yep
no
local zombieSpeed = 10 -- studs/sec
local zombieSize = Vector3.new(2, 4, 2) -- :GetExtentedSize()
local zombieStartPosition = Vector3.new(0, 2, 0) -- :GetPivot().Position
local point = Vector3.new(10, 0, 10) -- point to zombie need to go(let him on the ground to point)
local toGo = point + Vector3.new(0, zombieSize.Y/2, 0)
game["Run Service"].Heartbeat:Connect(function(dt)
timer += dt
zombieStartPosition:Lerp(toGo, math.clamp ( zombieSpeed * timer), 0, 1 )
end)
bro said no 💀
ALLAT FOR THIS?
@pure tangle we got scammed....
yep
bro even sent no logic code
stop i think
NOW GIMME MY 5+5 min
isnt this 26?
no 32
now
but there's still a lot to do if you're doing tower defense
uga buga 😦
why?