game.Players.PlayerAdded:Connect(function(player)
local CurrencyValue = Instance.new("NumberValue", player)
CurrencyValue.Name = "Currency"
CurrencyValue.Value = 0
end)
workspace:WaitForChild("Money").ClickDetector.MouseClick:Connect(function(player)
player.Currency.Value = player.Currency.Value + 69
end)
workspace:WaitForChild("Blackmarket").Shop.Box.Pistol.MouseButton1Click:Connect(function(player)
print("here")
if (player.Currency.Value -69) >= 0 then
player.Currency.Value = player.Currency.Value - 69
end
end)
This is the full Script. What it does is creates a NumberValue in the player's folder, and that NumberValue represents the player's cash.
workspace:WaitForChild("Money").ClickDetector.MouseClick:Connect(function(player)
player.Currency.Value = player.Currency.Value + 69
Here, it updates the NumberValue to 69 when the part 'Money' is clicked.
workspace:WaitForChild("Blackmarket").Shop.Box.Pistol.MouseButton1Click:Connect(function(player)
print("here")
This is the part which does not work. I'm trying to now take away the money when an ImageButton is clicked.
Blackmarket - Part || Shop - ScreenGUI || Box - Frame || Pistol - ImageButton
I can't get 'here' to be printed, which means the rest of my script won't work.

1 comment
Are you sure the Shop is a ScreenGUI? If its inside a part, then is should be a SurfaceGUI or BillboardGUI, or the ScreenGUI should be inside the StarterGUI