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

My Teleports Rotates on a weird Orientation, when I set it just to CFrame?

Asked by
Borrahh 265 Moderation Voter
4 years ago

Basically, I want the Part to move to that CFrame, then after 5 seconds, to come back. However, When Part Teleports Back, It also changed it's orientation, I tried to do

script.Parent.Orientation but it didn't work, anyone knows what's the issue?

local click = script.Parent.ClickDetector


click.MouseClick:Connect(function(click)
    print("I got clicked")
    script.Parent.CFrame = CFrame.new(1273.907, 237.592, -668.21)
    wait(5)
    script.Parent.CFrame = CFrame.new(1284.227, 237.592, -668.21)
end)
0
@EEnergy, I fixed line 7. It should work now... R_LabradorRetriever 198 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

The issue is that CFrames contain orientation data. Creating a CFrame creates a blank orientation,(0,0,0 i think). Try using a part with the orientation and position u want:

local part = -- put the part with the desired end orientation and position. It should be transparent and cancollide-false.

local click = script.Parent.ClickDetector

click.MouseClick:Connect(function(click)
    print("I got clicked")
    script.Parent.CFrame = part.CFrame
    wait(5)
    script.Parent.CFrame = CFrame.new(1284.227, 237.592, -668.21)
end)
0
good but i think you can also do script.Parent.CFrame = script.Parent.CFrame * part.CFrame but I don't know it will work on not. 123nabilben123 499 — 4y
0
Error: Workspace.GoldBars.Gold.Script:7: bad argument #1 (Vector3 expected, got CFrame) Borrahh 265 — 4y
0
.p gets the position of a CFrame, for example, part.CFrame.p zadobyte 692 — 4y
0
Ok, thx R_LabradorRetriever 198 — 4y
View all comments (3 more)
0
@EEnergy8, I fixed it R_LabradorRetriever 198 — 4y
0
Now it's even worse >.< I Get error: Workspace.GoldBars.Gold.Script:7: attempt to call a table value, in the script you are not even rotating it??? Borrahh 265 — 4y
0
what have u set the part variable to? R_LabradorRetriever 198 — 4y
Ad

Answer this question