Currently this tool for my simulator only works on PC. How can I also get this to work on mobile?

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

local RightShoulder = Character:WaitForChild("RightUpperArm"):WaitForChild("RightShoulder")
local C0 = RightShoulder.C0
local C1 = RightShoulder.C1

local Mouse = Player:GetMouse()
Root = Character:WaitForChild("HumanoidRootPart")


local Animation = Instance.new("Animation")
Animation.AnimationId = "http://www.roblox.com/Asset?ID=2546609286"
local Track = Humanoid:LoadAnimation(Animation)

local Dig = game:GetService("ReplicatedStorage"):WaitForChild("Events"):WaitForChild("Dig")


local Tool = script.Parent

local Equipped = false
local LastDug = tick()
local Holding = false

Mouse.Button1Down:Connect(function()
	Holding = true
	spawn(function()
		while Holding do
			if Equipped then
				if tick() - LastDug >= 1.5 then
					LastDug = tick()
					Track:Play()
					if Mouse.Target and Mouse.Target:FindFirstChild("Diggable") then
						if (Mouse.hit.p - Root.Position).magnitude <= 12 then
							spawn(function()
								game:GetService("SoundService"):WaitForChild("Digging"):Play()
								wait(1)
								game:GetService("SoundService"):WaitForChild("Digging"):Stop()
							end)
							Dig:FireServer(Mouse.Target)
						end
					end
				end
			end
			wait(1.5)
		end
	end)
end)

Mouse.Button1Up:Connect(function()
	Holding = false
end)


Tool.Equipped:Connect(function()
	Equipped = true
	spawn(function()
		while Equipped do
			if Mouse.Target and Mouse.Target:FindFirstChild("Diggable") then
				if (Mouse.hit.p - Root.Position).magnitude <=12 then
					Mouse.Icon = "rbxassetid://2489423725" else if (Mouse.hit.p - Root.Position).magnitude >= 12 and (Mouse.hit.p - Root.Position).magnitude <=20 then
						Mouse.Icon = "rbxassetid://2489399066"
					end
				end else
				Mouse.Icon = ""
			end
			wait()
		end
	end)
end)

Tool.Unequipped:Connect(function()
	Equipped = false
	Mouse.Icon = ""
end)

3 comments

0

block code please

0

You can do Tool.Activated if you want but not sure your script is on crack

0

I edited everything into a code block. Please be aware that you shouldn't post your entire code like this and expect people to be able to help you when you give 76 lines of code with minimal information.