Got the final problem i have been changing camera CFrame but i need to change only it’s position i guess this would help you i guess.
local cam = game.Workspace.Camera
mouse.Move:Connect(function()
if mouse.Hit.p ~= prev_mousehit then
vrhead.CFrame = CFrame.new(vrhead.Position,Vector3.new(cam.CFrame.LookVector.X,cam.CFrame.LookVector.Y,cam.CFrame.LookVector.Z) + vrhead.Position )
prev_mousehit = mouse.Hit.p
end
end)
local boolt = false
uis.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.W then
boolt = true
while boolt do
wait(0.02)
vrhead.Position += Vector3.new(cam.CFrame.LookVector.X * 1,0,cam.CFrame.LookVector.Z * 1)
end
end
end)
uis.InputEnded:Connect(function(key)
if key.KeyCode == Enum.KeyCode.W then
boolt = false
end
end)
In fact you can just add an attachment and place it in 1 studs to the part’s right side and add to it’s position the vector difference between their positions
Something like that
local attachment
local diff = attachment.WorldPosition - vrhead.Position
And then increase it’s position with this difference
vrhead.Position += diff
Or just set vrhead position to world position of an attachment
uis.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.A then
boolq = true
while boolq do
wait(0.02)
vrhead.Position += Vector3.new(cam.CFrame.LookVector.X,0,0)
end
end
end)
uis.InputEnded:Connect(function(key)
if key.KeyCode == Enum.KeyCode.A then
boolq = false
end
end)
uis.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.D then
boole = true
while boole do
wait(0.02)
vrhead.Position += Vector3.new(-cam.CFrame.LookVector.X,0,0)
end
end
end)
uis.InputEnded:Connect(function(key)
if key.KeyCode == Enum.KeyCode.D then
boole = false
end
end)
Put an attachment in vrhead and move it to the right
local attachment = Instance.new("Attachment",vrhead)
attachment.Position = Vector3.new(0,0,1) -- try this or this attachment.Position = Vector3.new(1,0,0)
uis.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.A then
boolq = true
while boolq do
wait(0.02)
local diff = attachment.WordPosition - vrhead.Position
vrhead.Position -= diff
end
end
end)
uis.InputEnded:Connect(function(key)
if key.KeyCode == Enum.KeyCode.A then
boolq = false
end
end)
uis.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.D then
boole = true
while boole do
wait(0.02)
local diff = attachment.WordPosition - vrhead.Position
vrhead.Position += diff
end
end
end)
uis.InputEnded:Connect(function(key)
if key.KeyCode == Enum.KeyCode.D then
boole = false
end
end)
local attachment = Instance.new("Attachment",vrhead)
attachment.Position = Vector3.new(0,0,1) -- try this or this attachment.Position = Vector3.new(1,0,0)
local attachment = Instance.new("Attachment",vrhead)
attachment.Position = Vector3.new(0,0,1) -- try this or this attachment.Position = Vector3.new(1,0,0)
uis.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.A then
boolq = true
while boolq do
wait(0.02)
local diff = attachment.WordPosition - vrhead.Position
vrhead.Position -= diff
end
end
end)
uis.InputEnded:Connect(function(key)
if key.KeyCode == Enum.KeyCode.A then
boolq = false
end
end)
uis.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.D then
boole = true
while boole do
wait(0.02)
local diff = attachment.WordPosition - vrhead.Position
vrhead.Position += diff
end
end
end)
uis.InputEnded:Connect(function(key)
if key.KeyCode == Enum.KeyCode.D then
boole = false
end
end)