game.Players.PlayerAdded:Connect(function(plr)
local leaderstats= Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = plr
local cash = Instance.new("IntValue")
cash.Name = "Dollars"
cash.Value = 122000
cash.Parent = leaderstats
game.Players.LocalPlayer.PlayerGui:WaitForChild("Camaro", 10).Camaro.Purchased.Value = false
end)
game.ReplicatedStorage:WaitForChild("CheckPrice").OnServerInvoke = function(player, NameOfCar)
return game.ServerStorage.Cars:FindFirstChild(NameOfCar).Price.Value
end
This script is in ServerScriptService, and someone suggested that the value should be set from here as it automatically runs. A GUI is also set in a 'phone' which sees whether a value is true or false, True = car spawner is there False = car spawner isn't there
local gui = game.Players.LocalPlayer.PlayerGui:WaitForChild("Camaro", 10).Camaro.Purchased -- add a waitforchild
local chevy = script.Parent.Parent.Chevy
script.Parent.MouseButton1Click:connect(function()
wait(0.3)
if gui.Value == true then
chevy.BackgroundTransparency = 0
chevy.ImageTransparency = 0
chevy.Purchase.BackgroundTransparency = 0
chevy.Purchase.TextStrokeTransparency = 0
chevy.Purchase.TextTransparency = 0
print("under")
elseif gui.Value == false then
print("hello")
end
end)
It always seems to print 'under' in the output, whether the purchase is true or 'false'. The BoolValue is controlled through the Car purchase Gui.
script.Parent.MouseButton1Click:connect(function()
local PriceOfItem = game.ReplicatedStorage:WaitForChild("CheckPrice"):InvokeServer(script.Parent.Parent.Name)
local purchase = script.Parent
local playermoney = game.Players.LocalPlayer.leaderstats.Dollars.Value
local purchasedvalue = game.Players.LocalPlayer.PlayerGui:WaitForChild("Camaro", 10).Camaro.Purchased
purchasedvalue.Value = false
if playermoney >= PriceOfItem then
playermoney = playermoney - PriceOfItem
purchase.BackgroundColor3 = Color3.new(255,23,23)
purchase.Text = "Purchased!"
wait(2)
purchase.BorderColor3 = Color3.new(255,0,0)
purchase.Text = [[Already
Purchased]]
purchase.TextSize = 40
purchasedvalue.Value = true
print("purchased")
elseif playermoney < PriceOfItem then
purchase.BorderColor3 = Color3.new(255,0,0)
purchase.BackgroundColor3 = Color3.new(255,23,23)
purchase.Text = [[Not enough
money!]]
purchase.TextSize = 40
wait(3)
purchase.BackgroundColor3 = Color3.new(23,255,23)
purchase.BorderColor3 = Color3.new(0,255,0)
purchase.Text = "Purchase"
purchase.TextSize = 75
purchasedvalue.Value = false
print("not purchased")
end
end)
Anyone can help?

3 comments
you cant use LocalPlayer in server scripts. additionally, the gui you mentioned in the first script needs to be handled on the client
changes made on the client such as properties (your BoolValue.Value) will not be replicated to the server with FE, RemoteEvents may solve ur problem
Are you sure it's a BoolValue?