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

How to make the model moving with CFrames in the best way?

Asked by
kapipi12 133
6 years ago
Edited 6 years ago
01seat = script.Parent
02tram = script.Parent.Parent.Parent
03local plr = game.Players.LocalPlayer
04 
05while wait() do
06    if seat.Occupant == nil then
07        --print("sitting")
08        seat.Occupant.Parent.isDriving.Value = true
09        --print (tram.Body.forward.Value)
10        while tram.Body.forward.Value == true do
11            --Here is script which moves the train but this one doesnt work
12            -- Ah, and "we have scripted things like pressing w etc"
13            script.Parent.Parent.CFrame = CFrame.new(script.Parent.Parent.CFrame + Vector3.new(0,0,1))
14            wait()
15        end
View all 22 lines...

How to fix that CFrame moving script, is there any good way (it need to be moved with players of course)?

0
lerp greatneil80 2647 — 6y

1 answer

Log in to vote
2
Answered by 6 years ago
Edited 6 years ago

If you want to move a Model using CFrame you could use SetPrimaryPartCFrame(). Just make sure your Model has a PrimaryPart. Read more it about here

Another way you can move your Model is using the Function TranslateBy(), which uses Vector3. Read more about it here

1
"red more about it" greatneil80 2647 — 6y
0
Lol, thanks. MRbraveDragon 374 — 6y
Ad

Answer this question