Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How come this doesn't work on mobile? (How do I get it to work on mobile/devices)

Asked by
ElBamino 153
3 years ago

Hey scriptinghelpers, this script does work on computer it does not work on mobile devices (phone and tablet). I actually just figured out that it doesn't work on mobile devices. I don't know why, because I'm not getting any output or anything and my other scripts work on mobile. This isn't actually the only script that doesn't work on mobile. They all work on computer, I know that for a fact. I really don't know much about making it mobile accessible so I would appreciate any help I can get! Below I will provide 2 scripts (they're both extremely similar). If there's any links I should know, please provide them. I'm only here to learn!

So this is a script inside of a part.

local replicatedstorage = game:GetService("ReplicatedStorage")
local tool = replicatedstorage:FindFirstChild("BC")
local debounce = true
script.Parent.Touched:Connect(function(hit)
    local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
    if player and player:WaitForChild("Backpack"):FindFirstChild("BC") == nil and player.MembershipType == Enum.MembershipType.Premium and debounce == true then
        debounce = false
        tool:Clone().Parent = player:WaitForChild("Backpack")
        wait(1)
        debounce = true
    end
end)

My other script (basically the same expect not premium)

local replicatedstorage = game:GetService("ReplicatedStorage")
local tool = replicatedstorage:FindFirstChild("Guest")
local debounce = true
script.Parent.Touched:Connect(function(hit)
    local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
    if player and player:WaitForChild("Backpack"):FindFirstChild("Guest") == nil and debounce == true then
        debounce = false
        tool:Clone().Parent = player:WaitForChild("Backpack")
        wait(1)
        debounce = true
    end
end)

How would I make it so these do work on mobile? Thanks in advance, I appreciate the help!

0
What Is This Script Supposed To Do? LoneSpace_Ranger 4 — 3y

Answer this question