This tool in my simulator game only works when you click on PC, I would also like it to work when you tap on mobile. I'm very confused with this and I'm thinking about just paying someone to help me fix this. Here is the script:
01 local Player = game.Players.LocalPlayer
02 local Character = Player.Character or Player.CharacterAdded:Wait()
03 local Humanoid = Character:WaitForChild("Humanoid")
04
05 local RightShoulder = Character:WaitForChild("RightUpperArm"):WaitForChild("RightShoulder")
06 local C0 = RightShoulder.C0
07 local C1 = RightShoulder.C1
08
09 local Mouse = Player:GetMouse()
10 Root = Character:WaitForChild("HumanoidRootPart")
11
12
13 local Animation = Instance.new("Animation")
14 Animation.AnimationId = "http://www.roblox.com/Asset?ID=2546609286"
15 local Track = Humanoid:LoadAnimation(Animation)
16
17 local Dig = game:GetService("ReplicatedStorage"):WaitForChild("Events"):WaitForChild("Dig")
18
19
20 local Tool = script.Parent
21
22 local Equipped = false
23 local LastDug = tick()
24 local Holding = false
25
26 Mouse.Button1Down:Connect(function()
27 Holding = true
28 spawn(function()
29 while Holding do
30 if Equipped then
31 if tick() - LastDug >= 1.5 then
32 LastDug = tick()
33 Track:Play()
34 if Mouse.Target and Mouse.Target:FindFirstChild("Diggable") then
35 if (Mouse.hit.p - Root.Position).magnitude <= 12 then
36 spawn(function()
37 game:GetService("SoundService"):WaitForChild("Digging"):Play()
38 wait(1)
39 game:GetService("SoundService"):WaitForChild("Digging"):Stop()
40 end)
41 Dig:FireServer(Mouse.Target)
42 end
43 end
44 end
45 end
46 wait(1.5)
47 end
48 end)
49 end)
50
51 Mouse.Button1Up:Connect(function()
52 Holding = false
53 end)
54
55
56 Tool.Equipped:Connect(function()
57 Equipped = true
58 spawn(function()
59 while Equipped do
60 if Mouse.Target and Mouse.Target:FindFirstChild("Diggable") then
61 if (Mouse.hit.p - Root.Position).magnitude <=12 then
62 Mouse.Icon = "rbxassetid://2489423725" else if (Mouse.hit.p - Root.Position).magnitude >= 12 and (Mouse.hit.p - Root.Position).magnitude <=20 then
63 Mouse.Icon = "rbxassetid://2489399066"
64 end
65 end else
66 Mouse.Icon = ""
67 end
68 wait()
69 end
70 end)
71 end)
72
73 Tool.Unequipped:Connect(function()
74 Equipped = false
75 Mouse.Icon = ""
76 end)
