Hey. I have a little script and the red square following the mouse position. I write the code for pc but thanks to roblox it's working with mobile too. But there is a big problem. When i move the square with my finger i can't walk with my other hand or red square jumps the new touch position. How can i make it only follow first touch position ? Is there any solution for this ?
Here is a video about my problem :
Here is my code :
local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer
local mouse = localPlayer:GetMouse()
local function spellBeingUsed(spell)
beingUsed = true
end
local function spellEnded()
beingUsed = false
end
RunService.RenderStepped:Connect(function(step)
if beingUsed then
obj.Transparency = 0.3
obj.Position = Vector3.new(mouse.Hit.p.X,0,mouse.Hit.p.Z)
else
obj.Transparency = 1
end
end)
