script.Parent.ClickDetector.MouseClick:Connect(function(player)
local prop = script.Parent.ProximityPrompt
prop.Enabled = false
local playerPoints = player.leaderstats.gold
playerPoints.Value = playerPoints.Value + 1
if playerPoints.Value += 100 then
prop.Enabled = true
end
end)
i want gold to be 100 or up then prop will be enabled but it not working
plz explain
Forummer
(Forummer)
February 3, 2022, 3:25pm
2
You’re disabling the ProximityPrompt whenever the ClickDetector is clicked.
Mystxry12
(Mystxry)
February 3, 2022, 3:26pm
3
script.Parent.ClickDetector.MouseClick:Connect(function(player)
local prop = script.Parent.ProximityPrompt
prop.Enabled = false
local playerPoints = player.leaderstats.gold
playerPoints.Value = playerPoints.Value + 1
if playerPoints.Value == 100 then
prop.Enabled = true
end
end)
You have to use == while comparing rather than +=
Forummer
(Forummer)
February 3, 2022, 3:27pm
4
local part = script.Parent
local click = part.ClickDetector
local prompt = part.ProximityPrompt
click.MouseClick:Connect(function(player)
prompt.Enabled = false
player.leaderstats.gold.Value += 1
if player.leaderstats.gold.Value >= 100 then
prompt.Enabled = true
end
end)
I see what you were trying to achieve, you just needed to use the “>=” or “>” operator.
Forummer
(Forummer)
February 3, 2022, 3:28pm
5
“>=” is fine, his issue was using “+=”. I see you’ve edited your post, this can be ignored.
Mystxry12
(Mystxry)
February 3, 2022, 3:29pm
6
Typo what can I say? ¯_( ͡❛ ͜ʖ ͡❛)_/¯