RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"Make a script that gets a sound ID from roblox and plays it when the player touches the coin"
-- script for the coin local part = script.Parent local soundId = "rbxassetid://123456789" -- replace with actual sound ID local function collect(otherPart) local player = game.Players:FindFirstChild(otherPart.Parent.Name) if player then local sound = Instance.new("Sound") sound.SoundId = soundId sound.Parent = part sound:Play() wait(sound.TimeLength) sound:Destroy() part:Destroy() player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 1 end end part.Touched:Connect(collect)