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

What is wrong with my code?

So I wanted to make a shop here you get a gun onClick. Well I have programmed it. But it doesnt work.

function onClicked(player)

if game.Players:FindFirstChild(player.Name).leaderstats.Coins.Value >= 2000 then 
local copy = game.Workspace.M1GarandParent.M1Garand:Clone()
copy.Parent = game.Players:FindFirstChile(player.Name).Backpack
game.Players:FindFirstChild(player.Name).leaderstats.Coins.Value = game.Players:FindFirstChild(player.Name).leaderstats.Coins.Value - 2000
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

1 answer

Line 5 says 'FindFirstChile' rather than 'FindFirstChild.'

2 comments

0

Oh thx

0

Just one typo can break a whole script... ;p

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