I have a text button that collects the Players money, but for some reason, 'SOMETIMES' it doesn't work, I've only had the issue once on PC, but on a Samsung Galaxy S7, it doesn't work at all, on a S8 it works fine and had a few iPhone users that it doesn't work for, haven't had any feedback from other devices, but seems a few people are having this issue in my game. how can I get both OnScreen and Model Buttons to work for all devices? why is it so inconsistent between different devices?
This is the current code im using for said Button
local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local Settings = require(workspace.Settings)
local button = script.Parent:WaitForChild("Collect", 500)
local collect = script.Parent:WaitForChild("Money", 500)
local mainCollect = script.Parent.Parent.Parent.Parent.Parent.Parent:WaitForChild("CurrencyToCollect", 500)
local Stealing = Settings.StealSettings
--Change Value on Screen
collect.Text = "$"..mainCollect.Value
mainCollect.Changed:connect(function() collect.Text = "$"..mainCollect.Value end)
--Click to Collect
button.MouseButton1Click:connect(function()
if script.Parent.Parent.Parent.Parent.Parent.Parent.Owner.Value == player then
local Stats = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
if Stats ~= nil then
--Add CollectSFX Here
Stats.Value = Stats.Value + mainCollect.Value
mainCollect.Value = 0
end
elseif Stealing.Stealing then -- if player isn't owner and stealing is on
if CanSteal == true then
CanSteal = false
delay(Stealing.PlayerProtection, function()
CanSteal = true
end)
local Stats = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
if Stats ~= nil then
local Difference = math.floor(mainCollect.Value * Stealing.StealPrecent)
--Add CollectSFX Here
Stats.Value = Stats.Value + Difference
mainCollect.Value = mainCollect.Value - Difference
end
end
end
end)
