Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I make the following "Pen" tool work for Tablet users?

Asked by
Jt93 0
9 years ago

I looked up the context service and still am having trouble figuring out what I'm supposed to do to make the Pen tool work for IOS/Tablet users. Here is a link to the model so you can take a quick look at it: http://www.roblox.com/Pen-item?id=270659368 The pen is being used in an obby and I'll supply the link if anyone needs it.

1 answer

Log in to vote
0
Answered by 9 years ago

Use the UserInputService to see if the software is touchscreen, next get the mouse and sees when he clicks, when that happens just use mouse.hit.p to find the cframe the mouse is at.

local userinputservice = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local on = false
local pen = player.Character.Pen --The pen

function touchscreen()
    return userinputservice.TouchEnabled
end

mouse.Button1Down:connect(function()
    on = true
    while on wait() do
        pen.Center.CFrame = mouse.hit.p --Replace Center with the part you want to be over the mouse.
    end
end)

mouse.Button1Up:connect(function()
    on = false
end)
0
And what do I do with that code? What part would go over the mouse? Jt93 0 — 9y
0
Thank you so much. It worked. Jt93 0 — 9y
Ad

Answer this question