-- Functions local function collectCoins() -- Find coins in the workspace for _, coin in pairs(workspace:GetDescendants()) do if coin:IsA("Part") and coin.Name == "Coin" then -- Move towards the coin humanoid:MoveTo(coin.Position) -- Collect the coin coin:Destroy() end end end
local function upgradeCharacter() -- Find the upgrade button local upgradeButton = script.Parent:FindFirstChild("UpgradeButton") if upgradeButton then -- Click the upgrade button upgradeButton:Fire() end end
-- Services local Players = game:GetService("Players") local RunService = game:GetService("RunService")
-- Variables local player = Players.LocalPlayer local character = player.Character local humanoid = character:FindFirstChild("Humanoid")