Hi! So ive been working on a building ui but the problem is if the player is on mobile when they click on ui like rotating or placing the model moves to the object. Is there any simple way to fix this?
Here is my code for mobile
UIS.TouchTapInWorld:Connect(function()
mouse.TargetFilter = previewobject
if previewobject:FindFirstChild("MainPart") then
local objectcframe = CFrame.new(math.round(mouse.Hit.Position.X/grid)*grid,math.round(mouse.Hit.Position.Y+previewobject.PrimaryPart.Size.Y/2), math.round(mouse.Hit.Position.Z/grid)*grid)
local objectangles = CFrame.Angles(0, math.rad(rotationamount), 0)
previewobject:SetPrimaryPartCFrame(objectcframe*objectangles)
end
end)
I tried your solution for some reason it still isnt working:
UIS.TouchTapInWorld:Connect(function(pos, proccesed)
if not proccesed then
mouse.TargetFilter = previewobject
if previewobject:FindFirstChild("MainPart") then
local objectcframe = CFrame.new(math.round(mouse.Hit.Position.X/grid)*grid,math.round(mouse.Hit.Position.Y+previewobject.PrimaryPart.Size.Y/2), math.round(mouse.Hit.Position.Z/grid)*grid)
local objectangles = CFrame.Angles(0, math.rad(rotationamount), 0)
previewobject:SetPrimaryPartCFrame(objectcframe*objectangles)
end
end
end)