Hunt down the nil characters, the silent tweens, and the sounds nobody hears.
The world's bugs are mostly about timing and who runs what: grabbing a character before it spawns, building a tween and never playing it, and playing sounds on the wrong computer. Three smells, five hunts.
A player joins and your script instantly errors on player.Character.Humanoid — nil.
Players.PlayerAdded:Connect(function(player)
local humanoid = player.Character.Humanoid
end)
Why is player.Character nil at join time?
Even inside CharacterAdded, the character's parts load over a few frames. Make the grab safe so it can't error on an unloaded part.
local humanoid = character.Humanoid
Write the line that grabs the Humanoid safely.
You built the tween perfectly — TweenInfo, goals, Create — and the part sits there. No error, no motion.
local info = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local goals = { CFrame = coin.CFrame + Vector3.new(0, 5, 0) }
local tween = TweenService:Create(coin, info, goals)
Write the missing line that starts the tween.
You click the coin, the coins go up, but there's no sound — on anyone's computer.
-- Script (server)
coin.ClickDetector.MouseClick:Connect(function(player)
coin.Sound:Play()
clickEvent:FireServer()
end)
The pickup sound plays nowhere. What's the likely cause?
You want the pickup sound to play for the clicking player, right before the reward is reported. Write the line that plays it.
coin.ClickDetector.MouseClick:Connect(function()
-- play the pickup sound here
clickEvent:FireServer()
end)
Write the line that plays the coin's sound on the client.
Assemble a coin pickup: a touch, a character, a player, a reward.