Hi I'm new around here, started scripting a couple of months ago, have basic knowledge. So in my game that's GUI based I'm trying to implement a shop to make land appear. I've tried tutorials and things to see what I have done wrong but nothing seems to work. Any help would be appreciated. Here's the script:
script.Parent.MouseButton1Click:connect(function()
local price = 250
local player = game.Players.LocalPlayer
local stats = player:WaitForChild("leaderstats")
if stats.Robux.Value >= price then
stats.Robux.Value = stats.Robux.Value - price
script.Parent.Parent.Parent.Parent.Land.Visible = true
end
end)
-- robux is my currency
I'm sure I've done something simple wrong but any help is appreciated.
Edit: The land is GUI based not actual blocks

5 comments
May I ask if there are any errors coming up when you try?
There are zero errors when I try I have tried many different scripts but none seem to work.
This is a LocalScript?
This should work if you put it inside a LocalScript.
Thanks it works now! Thank you everyone for their help.