Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[SOLVED] My in game currency land buying script isn't working?

Asked by 6 years ago
Edited 6 years ago

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

0
May I ask if there are any errors coming up when you try? LegitmateTrades 159 — 6y
0
There are zero errors when I try I have tried many different scripts but none seem to work. mistermarioguy78 4 — 6y
0
This is a LocalScript? User#19524 175 — 6y
0
This should work if you put it inside a LocalScript. AswormeDorijan111 531 — 6y
0
Thanks it works now! Thank you everyone for their help. mistermarioguy78 4 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Solved by other people - It needed to be in a local script.

Ad

Answer this question