I tried using print("Clicked") print("10") it prints clicked
mouse.Button1Down:Connect(function()
print("Clicked")
but not 10?
local num = math.random(1,10)
if num == "10" then
print("10")
These are in the same script which is a local script. Should it be a different script? This is the whole script
local tool = script.Parent
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
mouse.Button1Down:Connect(function()
print("Clicked")
local char = script.Parent.Parent
local plr = game.Players:GetPlayerFromCharacter(char)
local leaderstats = plr:FindFirstChild("leaderstats")
local Gold = leaderstats.Gold
local humanoid = tool.Parent.Humanoid
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/asset/?id=5498807074"
local animationTrack = humanoid:LoadAnimation(animation)
animationTrack:Play()
local num = math.random(1,10)
if num == "10" then
print("10")
Gold.Value = Gold.Value + 1
end
end)

1 comment
ok thanks!