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
Solved by other people - It needed to be in a local script.