How to set rotation of a model

So X has to be both 0 and 90?
Not possible
Do you want them to Tween? Change?

i want the tween the orientation of X like if i do Down:play() it will set the orientation x to 0 and if i do up:play() it will set the orientation x to 90 not at the same time.

You would set up a Tween like:

local part = part.here
local info = TweenInfo.new(1) --amount of seconds and easing styles
local targetDown = {part.Orientation = Vector3.new(0,0,0)}
local targetUp = {part.Orientation =Vector3.new(90,0,0)}
local tweenDown = game:GetService(“TweenService”):Create(part, info, targetDown)
local tweenUp = game:GetService(“TweenService”):Create(part, info, targetUp)

And then you simply call them in a Function

(Also part is the PrimaryPart)

based on your code the tween is going to move the model not rotate

@Dede_4242 your code is wrong. You need to provide a dictionary containing all the properties needed to be tween in the last argument for the Create function.

1 Like

You need to use weld and PrimaryPart for the model and you can’t use UserInputService in server scripts, you have to do it via local script and RemoteEvent

If I’m not wrong it’ll not, as Vector3 is a vector, to move you usually need CFrame
Also I just noticed I messed up everything so lemme edit the script

Sorry, I wrote it on phone from my mind so there surely is an error

Try it now, it should work as I edited the code

Please explain further
i welded all the parts to the primarypart
i made a local script wich works

local UserInputService = game:GetService("UserInputService")

local Key = Enum.KeyCode.V
local toggle = false

UserInputService.InputBegan:Connect(function(input, _gameProcessed)
	if input.KeyCode == Key then
		if toggle then
			game.Workspace.Goggles.Toggle:FireServer('Down')
			toggle = false
		else
			game.Workspace.Goggles.Toggle:FireServer('Up')
			toggle = true
		end
	end
end)

but the tweening service still doesnt work
server script:

local TweenService = game:GetService("TweenService")
local part = script.Parent.PrimaryPart

local Up = TweenService:Create(part, TweenInfo.new(1), {Orientation = Vector3.new(90,part.Orientation.Y,part.Orientation.Z)})


local Down = TweenService:Create(part, TweenInfo.new(1), {Orientation = Vector3.new(0,part.Orientation.Y,part.Orientation.Z)})

script.Parent.Toggle.OnServerEvent:Connect(function(plr, toggle)
	if toggle == 'Up' then
		Up:Play()
	else
		Down:Play()
	end
end)

Try this, if it works, but in the wrong direction - just adjust for yourself

local Up = TweenService:Create(part, TweenInfo.new(1), {CFrame = part.CFrame*CFrame.Angles(math.rad(90), 0, 0)})
local Down = TweenService:Create(part, TweenInfo.new(1), {CFrame = part.CFrame*CFrame.Angles(0, 0, 0)})

the tweening service works but its only rotating the primary part and nothing else and when i move it, it teleports back to its old position.

check if you welded the parts correctly

is weld in the constraints tab

Can you send the model with the script you are currently using?

here oh and i forgot make a local script and put is in starterplayer script:

local UserInputService = game:GetService("UserInputService")

local Key = Enum.KeyCode.V
local toggle = false

UserInputService.InputBegan:Connect(function(input, _gameProcessed)
	if input.KeyCode == Key then
		if toggle then
			game.Workspace.Goggles.Toggle:FireServer('Down')
			toggle = false
		else
			game.Workspace.Goggles.Toggle:FireServer('Up')
			toggle = true
		end
	end
end)

With the welding itself, I want to see if and how you did it

i selected the primary part pressed the weld icon and welded all the other parts by clicking them

Left is mine
Right is yours
You did the wrong welding. Download my model and check it.
Goggles.rbxm (74,7 КБ)

image

that solved one problem now for the other when i try to move it it teleports back to its old position