Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how to make tween not go through walls?

Asked by 2 years ago

so im trying to make a part be like a npc, and rn im making the movement. So ive already make it so it can move forward using tween but it just keeps going through the walls (he has a closed house) so how do i fix that?

here is the script:

local part = script.Parent

while true do

local distance = 10 local tween = game:GetService("TweenService"):Create(part, TweenInfo.new(1, Enum.EasingStyle.Linear), {CFrame = part.CFrame + (part.CFrame.LookVector * distance)})

tween:Play()
wait(4)
end
0
Can't you set CanCollide of the part to true? MarkedTomato 810 — 2y
0
You probably should not be using tween for npc movement but if ur going to achieve it with tween then you should probably raycast towards where the npc is looking at and can tween it to where the ray is intersected at sata5pa3da 286 — 2y

Answer this question