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

Why my part position doesn't change?

local Mouse = game.Players.LocalPlayer:GetMouse()
local Camera = game.Workspace.CurrentCamera
local LastY = 0

local DefaultCFrame = workspace.Part.CFrame
local Part = workspace.Part

repeat wait() Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = DefaultCFrame



game:GetService("RunService").RenderStepped:Connect(function()
	Mouse.Move:Connect(function()	
	if Mouse.Y <= 21 then -- My top Barrier
	if Mouse.Y - LastY <= -1 then	-- Detecting if the Mouse is Moving up 	
	local MoveVector = Vector3.new(0,-(Mouse.Y*1), 0)
       Camera.CFrame = DefaultCFrame * CFrame.new(DefaultCFrame.p + MoveVector)
       Part = Vector3.new(DefaultCFrame.Position + MoveVector) -- it came back to the same 
       position everytime			
				
    LastY = Mouse.Y					 
		 	  else LastY = Mouse.Y  -- Will read the last if Conditions	
		   end
		end
	end)	
end)	


1 answer

✓ Accepted answer

Check for output errors, what i know that you might have as a problem is that if it is a local script then it usually executes before some parts load so try using:

local part = workspace:WaitForChild("Part")

Best thing is always check the output and look for problem as you will be 99% sure what the problem is.

Also line 20, did you mean Part.CFrame?

2 comments

0

There's non error

0

Well then if you want to move part then use Part.CFrame as i said. By doing Part  = ... you are changing part variable to that position.

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