well, i am not using it since it didn’t helpo but lemme provide server code aswell!
remotes.Purchase.OnServerInvoke = function(player, GateValue)
for _, v in pairs(game.Workspace.Gate_System.Gates:GetChildren()) do
local GateValue = player.GateFolder:WaitForChild(v.Config.NameGate.Value)
if player.leaderstats.Coins.Value >= v:WaitForChild("Config"):WaitForChild("Price").Value then
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value - v:WaitForChild("Config"):WaitForChild("Price").Value
GateValue.Value = true
remotes.Purchase:InvokeClient(player, GateValue)
end
end
end
if player.leaderstats.Coins.Value >= v.Config.Price.Value then
remotes.Purchase:InvokeServer(player, player.leaderstats.Coins.Value)
remotes.Purchase.OnClientInvoke = function(player, GateValue)
GateValue:GetPropertyChangedSignal("Value"):Connect(function()
if GateValue and gateValue.Value == true then
v.CanCollide = false
v.Screen.PriceText.Visible = false
v.Screen.NameText.Visible = false
v.Screen.PurchaseButton.Visible = false
v.Transparency = 1
end
end)
end
end
Of course it doesn’t work lol, it’s inside the if statement. That’s why it won’t run. Put everything inside of the getpropertychangedsignal. Put it outside.
GateValue:GetPropertyChangedSignal("Value"):Connect(function()
if player.leaderstats.Coins.Value >= v.Config.Price.Value then
remotes.Purchase:InvokeServer(player, player.leaderstats.Coins.Value)
remotes.Purchase.OnClientInvoke = function(player, GateValue)
if GateValue and gateValue.Value == true then
v.CanCollide = false
v.Screen.PriceText.Visible = false
v.Screen.NameText.Visible = false
v.Screen.PurchaseButton.Visible = false
v.Transparency = 1
end
end
end
end)
local player = game:GetService("Players").LocalPlayer
local remotes = game.ReplicatedStorage.Gate_System
for _,v in ipairs(game.Workspace.Gate_System.Gates:GetChildren()) do
local gateValue = player:WaitForChild("GateFolder"):WaitForChild(v.Config.NameGate.Value)
v.Screen.PurchaseButton.MouseButton1Click:Connect(function(clicked)
script.Parent.GateFrame.Visible = true
script.Parent.GateFrame.Close.MouseButton1Click:Connect(function(clicked)
script.Parent.GateFrame.Visible = false
end)
script.Parent.GateFrame.Continue.MouseButton1Click:Connect(function(clicked)
script.Parent.GateFrame.Visible = false
gateValue:GetPropertyChangedSignal("Value"):Connect(function()
if player.leaderstats.Coins.Value < v.Config.Price.Value or player.leaderstats.Coins.Value <= 1 then
script.Parent.GateErrorFrame.Visible = true
else
if player.leaderstats.Coins.Value >= v.Config.Price.Value then
remotes.Purchase:InvokeServer(player, player.leaderstats.Coins.Value)
remotes.Purchase.OnClientInvoke = function(player, GateValue)
if GateValue and gateValue.Value == true then
v.CanCollide = false
v.Screen.PriceText.Visible = false
v.Screen.NameText.Visible = false
v.Screen.PurchaseButton.Visible = false
v.Transparency = 1
end
end
end
end
end)
end)
script.Parent.GateErrorFrame.Close.MouseButton1Click:Connect(function(clicked)
script.Parent.GateErrorFrame.Visible = false
end)
end)
end
it didn’t work and also wont since the variable gatevalue ill not work then
yk