Hello, I am using InputObject.Position, but I need that value in real time, can someone tell me what is happening?
My Code:
function RotateModelInput(val)
print(val)
local model = workspace.PartsToFunSpawn:FindFirstChildWhichIsA("Model")
if model and model.PrimaryPart then
model:SetPrimaryPartCFrame(model:GetPrimaryPartCFrame() * CFrame.Angles(0, math.rad(val), 0))
end
end
local id = nil
local e
function OnInputBegan(input:InputObject)
if input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then
print("Hola")
id = input
local pos = input.Position.X
e = input:GetPropertyChangedSignal("Position"):Connect(function()
if id == input then
print(pos)
local val = (pos - input.Position.X)/10
RotateModelInput(val)
pos = input.Position.X
end
end)
end
end
function OnInputEnded(input)
if input == id then
id = nil
e:Disconnect()
print("Fin")
end
end