Local:
local player = game:GetService("Players").LocalPlayer
local button = player.PlayerGui:WaitForChild("ShopGui").shopMain.buyThingButton0
local equipButton = player.PlayerGui:WaitForChild("ShopGui").shopMain.equipButton0
local character = player.Character
local tool = game:GetService("ReplicatedStorage"):WaitForChild("Tools"):FindFirstChild("Dumbbell1") or player:WaitForChild("Tools"):FindFirstChild("Dumbbell1")
--if tool.Parent == game:GetService("ReplicatedStorage"):WaitForChild("Tools") then
-- button.Visible = true
--elseif tool.Parent == player:WaitForChild("Tools") then
-- button.Visible = false
--end
local ld = player:WaitForChild("leaderstats")
local main = script.Parent.Parent.ShopGui.shopMain
local tween = game:GetService("TweenService")
local buyTool = game:GetService("ReplicatedStorage"):WaitForChild("Remotes").buyTool
local function close()
game:GetService("SoundService").click:Play()
local Info = TweenInfo.new(0.15)
local Tween = tween:Create(main, Info, {Position = UDim2.new(0.205, 0, 1, 0)})
Tween:Play()
game:GetService("Lighting").Blur.Enabled = false
tween:Create(game.Workspace.CurrentCamera, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {FieldOfView = 70}):Play()
end
local function buy()
if player:WaitForChild("leaderstats").Wins.Value >= 1 then
tool.Parent = player:WaitForChild("Tools")
button.Visible = false
player:WaitForChild("leaderstats").Wins.Value -= 1
buyTool:FireServer(tool.Name)
end
end
local function getTool(stat)
local backpackItems = player.Backpack:GetChildren()
local equipped = player.Character:FindFirstChildOfClass("Tool")
local warehouse = player:WaitForChild("Tools"):GetChildren()
if equipped and equipped.stat.Value == stat then
return equipped
end
for _, tool in pairs(backpackItems) do
if tool.stat.Value == stat then
return tool
end
end
for _, tool in pairs(warehouse) do
if tool.stat.Value == stat then
return tool
end
end
end
local function equip()
local statTool = tool.stat.Value
local currentTool = getTool(statTool)
currentTool.Parent = player:WaitForChild("Tools")
game:GetService("ReplicatedStorage"):WaitForChild("Settings").currentTool.Value = tool.Name
tool.Parent = character
close()
end
button.MouseButton1Click:Connect(buy)
button.TouchTap:Connect(buy)
equipButton.MouseButton1Click:Connect(equip)
equipButton.TouchTap:Connect(equip)
So here I have my local script, its essence when you press the button to equip an item from the rp, carry it in the hand of the player, but of course the item can lie not only in the rp, but also in the warehouse of the player in short, I’m looking for where the desired item and equip it. Everything worked well, I released my game. And I had no big bugs, but when I decided to play with a tablet, I saw that for some reason pressing the button equip does not work. I was already thinking that the script was broken, but when I logged on to the computer with the same account as on the tablet, everything worked on the computer.
That is, the same account, on the tablet clicking on the equipment does not work, but on the computer it works.
I checked the line on f9 and there were no errors there.
Question: if the problem is really in clicking on the button from mobile devices then how is it pof