Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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)

1 comment

0

@EEnergy, I fixed line 7. It should work now...

1 answer

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)

7 comments

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.

0

Error: Workspace.GoldBars.Gold.Script:7: bad argument #1 (Vector3 expected, got CFrame)

0

.p gets the position of a CFrame, for example, part.CFrame.p

0

Ok, thx

0

@EEnergy8, I fixed it

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???

0

what have u set the part variable to?

This discussion is preserved as it was. New answers, comments, and votes are closed.