I am trying to make a mobile only game on roblox but i cant find the positions of touch when the player is multi touching and dragging. Any help?
UserInputService:GetMouseLocation()
This would also work for touches.
i know that this exists, I also put myself together some code
rs.RenderStepped:Connect(function()
local c = script.Parent.Frame:Clone()
c.Parent = script.Parent
c.Position = UDim2.fromOffset(mouse.X, mouse.Y)
ts:Create(c, TweenInfo.new(1), {BackgroundTransparency = 1}):Play()
ts:Create(c, TweenInfo.new(1), {Position = UDim2.fromOffset(mouse.X+math.random(-20,20), mouse.Y+math.random(-20,20))}):Play()
game.Debris:AddItem(c, 1)
end)
but mouse only exists in one place
Ignore this reply, it is no longer needed.
what do you mean? i use mouse = plr:GetMouse()
Can you tell me the hierarchy of the frame and the script? (A hierarchy means how the instances are parented in the explorer. Send a screenshot.)
it doesnt work for multi touch
does it matter?
local rs = game:GetService("RunService")
local ts = game:GetService("TweenService")
local uis = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
rs.RenderStepped:Connect(function(i, gp)
local ml = uis:GetMouseLocation()
local c = script.Parent.Frame:Clone()
c.Parent = script.Parent
c.Position = UDim2.fromOffset(ml.X, ml.Y)
ts:Create(c, TweenInfo.new(1), {BackgroundTransparency = 1}):Play()
game.Debris:AddItem(c, 1)
end)
You can’t rely on mouse-related functions for touchscreen enabled devices, use the ‘TouchTap’ event I provided above.
Oh…
It does as I needed to know how to frame is parented but I now see that it’s nothing special.
If I may ask, why are you cloning the frame so many times a second? Are you making a trail of some sort?
If so, why not use the link Forummer has sent? A.K.A; use .TouchTap event?
touchMoved worked! thanks to all of you guys who help contribute to this topic! (i reply like an npc lol)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.