Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What is wrong with my code?

Asked by 8 years ago

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

Log in to vote
0
Answered by
JJ_B 250 Moderation Voter
8 years ago

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

0
Oh thx thenasafarouk 25 — 8y
0
Just one typo can break a whole script... ;p lucas4114 607 — 8y
Ad

Answer this question