#error code
8 messages · Page 1 of 1 (latest)
local player = game.Players.LocalPlayer
script.Parent.MouseClick:Connect(function()
if game:GetService("Players")[player.Name]:FindFirstChild("leaderstats") then
local Part = Instance.new("Part")
Part.BrickColor = BrickColor.random()
Part.Parent = game.Workspace
game:GetService("Players")[player.Name]:FindFirstChild("leaderstats").Coins.Value -= 4
elseif game:GetService("Players")[player.Name]:FindFirstChild("leaderstats").Coins.Value < 4 then
print("Not enough Coins!")
else
print("For some reason, the player doesn't have leaderstats")
end
end)
Try this
Copy in to your script
And make sure to make it localScript
Wait
local player = game.Players.LocalPlayer
script.Parent.MouseClick:Connect(function()
if game:GetService("Players")[player.Name]:FindFirstChild("leaderstats").Coins.Value >= 4 and game:GetService("Players")[player.Name]:FindFirstChild("leaderstats") then
local Part = Instance.new("Part")
Part.BrickColor = BrickColor.random()
Part.Parent = game.Workspace
game:GetService("Players")[player.Name]:FindFirstChild("leaderstats").Coins.Value -= 4
elseif game:GetService("Players")[player.Name]:FindFirstChild("leaderstats").Coins.Value < 4 and game:GetService("Players")[player.Name]:FindFirstChild("leaderstats") then
print("Not enough Coins!")
else
print("For some reason, the player doesn't have leaderstats")
end
end)
Try this
** You are now Level 6! **