Fixed it myself
I am trying to Change the position of a part through a textbutton
Vector3 is not changing the position neither Orientation ethrough script.
I printed something after the function executed to see that the function was running.
I am using a script(not local script)
The script is child of the textbutton
And the script is under startergui.
--
wait(20)
script.Parent.Visible = true
function clicked()
game.Workspace.CameraPart.Position = Vector3.new(45.821, 21.695, 45.2)
game.Workspace.CameraPart.Orientation = Vector3.new(45.821, 21.695, 45.2)
print("Finish")
end
script.Parent.MouseButton1Click:Connect(clicked)
Use a CFrame! CFrame’s do this and more CFrames | Documentation - Roblox Creator Hub in your case
I think game.Workspace.CameraPart.CFrame = CFrame.new(45.821, 21.695, 45.2,45.821, 21.695, 45.2)) should work
First of all, you should put everything except for script.Parent.Visible = true above the wait(20). That might be what is causing the issue.
Also, if you are intending for it to change on the server, you will need to use a RemoteEvent. otherwise only the player who clicked the button will see the part move and no one else. RemoteEvent | Documentation - Roblox Creator Hub