Hi there biocommand here with another doubt, I made a ScreengGui and from there I inserted an Imagebutton and inside the ImageButton I inserted a script so the order is like this ScreenGui>ImageButton>Script Now what I wanted to do is the when you click the ImageButton a car gets cloned from lighting and inserted on workspace if you have more or equal 5 points heres the script:
script.Parent.MouseButton1Down:connect(function()
-- Check the player has a stats object
local stats = player:FindFirstChild('leaderstats')
if not stats then return end
-- And that the stats object contains a gold member
local gold = stats:FindFirstChild('Score')
if not gold then return end
if gold.Value >= 5 then -- 5 is the amount of gold you need to purchase this weapon
clon = game.Lighting.Car2:Clone()
clon.Parent = Workspace
clon:MakeJoints()
gold.Value = gold.Value - 5 -- subtract the amount of gold you need to purchase
end
end)

3 comments
Is player defined?
ooohh.....
Midnight how would I define player?