Trying to move a part up

Right, so I was coding a system to move a part up and down and I also want a part to rotate. Now, I do want you to mainly focus no moving the part up. Now, for better understanding, I’m basically making a build system and when you press T, I wan’t the part to move up by 10 studs. Here’s what I’ve tried:

not the full code

	uis.InputBegan:Connect(function(input, isTyping)
			if isTyping then return end
			if input.KeyCode == Enum.KeyCode.T then
				client:SetPrimaryPartCFrame(CFrame.new(client.Primary.Position + Vector3.new(0,10,0)))
			end
		end)

And yes, I’ve added a print statement to check if the input was doing okay and it was indeed doing okay.

If you are trying to move the character when you press T, then make sure you are setting the characters CFrame and not the players CFrame. I wasn’t sure if the variable client was the player or the character.

local UIS = game:GetService('UserInputService')
local localPlayer = game.Players.LocalPlayer

uis.InputBegan:Connect(function(key)
   if key.KeyCode == Enum.KeyCode.T then
      localPlayer.Character:SetPrimaryPartCFrame(CFrame.new(client:GetPrimaryPartCFrame().Position + Vector3.new(0, 10, 0)))
   end
end)

Okay, I’m not actually trying to set the client’s CFrame. Apologies for that but instead, I’m trying to set a model CFrame.

Ok. Just change the script that I gave you into this:

local UIS = game:GetService('UserInputService')

-- Create function to move the part
local movePart = function(part, moveAmount)
   part.Position = part.Position + moveAmount
end

UIS.InputBegan:Connect(function(key)
   if key.KeyCode == Enum.KeyCode.T then
      movePart(part, Vector3.new(0, 10, 0)) -- Move the part with our function. Make sure to define the part and change the move amount if you want.
   end
end)

Nope, that moved my other parts into that position 0,10,0. I want it to add on that. Here’s my script:

	local movePart = function(part, moveAmount)
			part.Position = part.Position + moveAmount
		end

		UIS.InputBegan:Connect(function(key)
			if key.KeyCode == Enum.KeyCode.T then
				movePart(client.PrimaryPart, Vector3.new(0, 10, 0)) -- 
			end
		end)
local player = game.Players.LocalPlayer
local UIS = game:GetService("UserInputService")
local model = -- you will need to define this yourself

local function TranslateModel(model,offset) -- translates a model, in local coordinates
    local origin = model.PrimaryPart.CFrame
    model:SetPrimaryPartCFrame(origin*offset)
end

UIS.InputBegan:Connect(function(key)
    if key.KeyCode == Enum.KeyCode.T then
       TranslateModel(model,CFrame.new(0,10,0))
    end
end)

EDIT: I just read this, edited the code

P.S. if you wanted to translate the model relative to the world axis, you would instead set the origin variable equal to…

origin = CFrame.new(model.PrimaryPart.Position)

Otherwise, if you use the original code, it will move 10 studs in local coordinates, meaning 10 studs from the Top surface of the PrimaryPart in the direction of its surface normal. So if your model’s local Y axis is not aligned to the world’s Y axis, you’d get a different result.

Right, unfortunately this also didn’t work(this may be getting tricky). All it did was flicker. I tried checking the Primary Part’s position but it never changed upwards.

have you tried this?

local model = ---your part's path
if key.KeyCode == Enum.KeyCode.T then
	model.Position = Vector3.new(model.Position.X,model.Position.Y+10,model.Position.Z)
end

This did kind of work but there were a couple of problems.

NO.1 I want to move the whole model not the primary part only

NO.2 It’s for some reason moving it up WAYY too much studs

ok so Idk if there’s a better way to do it but this is what I came up with:

local model = ---your model's path    
UIS.InputBegan:Connect(function(key)
    	if key.KeyCode == Enum.KeyCode.T then
    		for i,v in pairs(model:GetChildren()) do
    			if v:IsA("Part") then
    				v.Position  = Vector3.new(v.Position.X,v.Position.Y+1,v.Position.Z)
    			end
    		end
    	end
    end)

Sorry for the late reply but I believe I found a solution, here’s my solution:

			client:SetPrimaryPartCFrame(client:GetPrimaryPartCFrame() * CFrame.new(0, math.rad(4), 0))