Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

[SOLVED] How do I make mobile buttons for phones and tablets?

2 answers

✓ Accepted answer

Put a screengui in startergui, then put a textbutton. For the leaderstats, put this code into ServerScriptService:

--leaderstats code
local function onPlayerJoin(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "nameyouwant"
	leaderstats.Parent = player
 
	-- Display an 'IntValue' on leaderboard
	local gold = Instance.new("IntValue")
	gold.Name = "yourname"
	gold.Value = 0
	gold.Parent = leaderstats
end
 
-- Run 'onPlayerJoin()' when the 'PlayerAdded' event fires
game.Players.PlayerAdded:Connect(onPlayerJoin)
-- code for button (same script in sss)
function clicked()
local point = 1
if game.StarterGui.ScreenGui.TextButton.Activated then
	game.StarterGui.ScreenGui.TextButton.Activated:Connect(function()
	gold.Value = gold.Value + point
end)
end
-- then loop the function to keep checking if player clicked the button
while true do
clicked()
print("works") -- not needed, but i do it to check if loop works
wait(0.5) -- if exhaust time is in output, add more wait time
end 

1 comment

0

BTW: I didn't test this out.

while true do
	wait()
	if script.Parent.Activated then
		local leaderboard = game.Players.LocalPlayer:FindFirstChild("leaderstats")
		local respect = leaderboard:FindFirstChild("Respect")
		respect.Value = respect.Value + 1
		local audio = workspace:FindFirstChild("RESPECT THE VETS")
		audio:Play()
		script.Parent.BackgroundTransparency = 0.5
		wait(1)
		script.Parent.BackgroundTransparency = 0
	end
end

my script

This discussion is preserved as it was. New answers, comments, and votes are closed.