I have a problem where when I activate the magic function and when I click on the screen to release it, it doesn’t go, I have to click 2 times to exit the magic
How do I resolve this?
Skill script in tool:
function touchStart(position, processedByUI)
-- Do not create a part if the player clicked on a GUI/UI element
if processedByUI then
return
end
local UnitRay = workspace.CurrentCamera:ViewportPointToRay(position.X, position.Y)
local NewRay = Ray.new(UnitRay.Origin, UnitRay.Direction * 500)
local hitPart, worldPosition = workspace:FindPartOnRay(NewRay)
-- Here he carries the magic
end
function touchEnd()
-- Here he unleashes the magic
end
UIS.TouchTapInWorld:Connect(touchStart)
UIS.TouchEnded:Connect(touchEnd)