Hello. I have been trying trying to make a one time purchase for buses on my game Bus Simulator.I was doing the code and was ready to test it. However, it did not work as i wanted it to. LocalScript:
local Player = game.Players.LocalPlayer
local ExampleEvent = game:GetService("ReplicatedStorage"):WaitForChild("PlaxtonSingle")
local GUIButton = script.Parent
GUIButton.MouseButton1Down:Connect(function()
if Player.vehStats.PlaxtonOwned.Value >= 1 then
ExampleEvent:FireServer()
script.Parent.Text = "Success!"
wait(1)
script.Parent.Parent.Parent.ScrollingFrame.Visible = false
script.Parent.Parent.Visible = false
elseif Player.leaderstats.Money.Value >= 9000 then
ExampleEvent:FireServer()
script.Parent.Text = "Success!"
wait(1)
script.Parent.Parent.Parent.ScrollingFrame.Visible = false
script.Parent.Parent.Visible = false
Player.vehStats.PlaxtonOwned.Value = 1
Player.leaderstats.Money.Value = Player.leaderstats.Money.Value -9000
end
end)
as you can see i want to know if the player owns the plaxton already using a value. However, if the player has not bought it it buys it for the player and changes the value to 1. I play the game and i have 555,555 money i spawn it and i sais success however i do not loose any money at all when i have 0 on the PlaxtonOwned value. Then when i put the value to 1 i try to spawn it and it does not work like i dont have enough money or own it. Please help i really want to get this to work.
