I need help making right click on mobile, I have a script that you can pick up and place an item with a click and a right click (Script Below) but I don’t know how I would do that.
local ToolNames = {"SCP-178", "Item", "Item"}
local Storage = game:GetService("ServerStorage")
local Part = script.Parent
local ClickDetector = Part:WaitForChild("ClickDetector")
local Debounce = false
script.Parent.ClickDetector.MouseClick:Connect(function(player)
if player and player.Character and not Debounce then
local Backpack = player.Backpack
for i = 1, #ToolNames do
local Tool = Storage:FindFirstChild(ToolNames[i])
if Tool then
local Tool = Tool:Clone()
local Tool2 = Tool:Clone()
Tool.Parent = Backpack
Tool2.Parent = player.StarterGear
local gui = Instance.new("ScreenGui",player.PlayerGui)
local textlabel = Instance.new("TextLabel",gui)
local tweenService = game:GetService("TweenService")
workspace.pickitem2:Play()
textlabel.Size = UDim2.new(0, 482,0, 46)
textlabel.BackgroundTransparency = 1
textlabel.BorderSizePixel = 0
textlabel.TextColor3 = Color3.new(1, 1, 1)
textlabel.Font = "SpecialElite"
textlabel.Position = UDim2.new(0.362, 0,0.734, 0)
textlabel.TextSize = "20"
textlabel.Text = "You picked up SCP-178"
textlabel.TextTransparency = 0
local timeToFade = 5
local object = textlabel
local tweenInfo = TweenInfo.new(timeToFade)
local goal = {
['TextTransparency'] = 1
}
local tween = tweenService:Create(object,tweenInfo, goal)
tween:Play()
workspace["3D Glasses"].Transparency = 1
Debounce = true
end
end
end
end)
script.Parent.ClickDetector.RightMouseClick:Connect(function(player)
if player and player.Character and Debounce then
local Backpack = player:WaitForChild("Backpack")
for i = 1, #ToolNames do
local Tool = Storage:FindFirstChild(ToolNames[i])
if Tool then
local gui = Instance.new("ScreenGui",player.PlayerGui)
local textlabel = Instance.new("TextLabel",gui)
local tweenService = game:GetService("TweenService")
workspace.pickitem2:Play()
textlabel.Size = UDim2.new(0, 482,0, 46)
textlabel.BackgroundTransparency = 1
textlabel.BorderSizePixel = 0
textlabel.TextColor3 = Color3.new(1, 1, 1)
textlabel.Font = "SpecialElite"
textlabel.Position = UDim2.new(0.362, 0,0.734, 0)
textlabel.TextSize = "20"
textlabel.Text = "You Placed SCP-178"
textlabel.TextTransparency = 0
local timeToFade = 5
local object = textlabel
local tweenInfo = TweenInfo.new(timeToFade)
local goal = {
['TextTransparency'] = 1
}
local tween = tweenService:Create(object,tweenInfo, goal)
tween:Play()
workspace["3D Glasses"].Transparency = 0
Debounce = false
Backpack:WaitForChild("SCP-178",1):Destroy()
player.StarterGear:WaitForChild("SCP-178",1):Destroy()
end
end
end
end)