Base your code on the sample code I sent a couple of messages ago
I will do so.
Sorry for asking a lot of questions, iām new with the CFrame theory so this is all a bit new.
Okay, it was a simple fix.
local newposition = position + playerroot.CFrame.RightVector
I believe you should be using LookVector for the newposition
Apparently not. I tried LookVector and it broke it, so RightVector is the solution I think.
Wait a second no, there are problems with this.
Oh?
I believe LookVector should be the correct thing in this case. What was the issue that you encountered?
Wait, now it broke completely. Using two scripts is complicated sometimes.
Iāll fix it and get it to the original point, then iāll show you what the problem is.
Okay, I think I made a working solution now.
So now it works pretty well. The van always comes 7 studs forward and 50 studs behind. Now I just have to make the if statement more accurate.
right now, itās like this:
if math.abs(sidedoor.CFrame.X - playerroot.CFrame.X) < 0.5 then
This causes some problems, when the player root is at an angle. the problem is that the van doesnt stop exactly at the side door.
How would you change the if statement so it would use the Rightvector magic that you taught me?
You shouldnāt need to do that. Just check if the tween finishes playing using
TWEEN.Completed:Wait()
or
TWEEN.Completed:Once(function()
-- Code
end)
edit: Iām going to bed now (itās 1am). Someone else will be able to help if you have any issues, otherwise Iāll be on in about 8 hours and can help then
Hmm, yes this would seem like a better solution.
right now, its in a while task.wait() do
loop, which I donāt need anymore if I can just stop the tween etc.
Iāll show you the result once I get it to function.
Okay, I couldnāt upload the video as it is too large, but now it works flawlessy.
Thank you very much for your help and patience
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.