I solved this by using a tutorial. But thanks to the comments for helping!
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
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