Hello, i have this code i followed from a tutorial on how to make a car spawner. But the GUI doesn't work. It gives me an error saying "Cash is not a valid member of Folder". Can you please tell me what is wrong here?
script.Parent.MouseButton1Click:Connect(function() if script.Parent.Parent.Purchased.Value == true then -- Spawn it game.ReplicatedStorage.SpawnCar:FireServer(script.Parent.Parent.Name) else -- Let them purchase it local PriceOfItem = game.ReplicatedStorage:WaitForChild("CheckPrice"):InvokeServer(script.Parent.Parent.Name) if game.Players.LocalPlayer.leaderstats.Cash.Value >= PriceOfItem and script.Parent.Parent.Purchased.Value == false then -- The player has enough cash game.Players.LocalPlayer.leaderstats.Cash.Value = game.Players.LocalPlayer.leaderstats.Cash.Value - PriceOfItem script.Parent.Parent.Purchased.Value = true end end end)
put the car in serverstorage instead
game.ServerStorage.Car:Clone.Parent = game.Workspace game.Workspace.Car.CFrame = CFrame.new(position in here)
unless u already have put it somewhere in that case you dont need the second line
if game.Players.LocalPlayer.leaderstats.Cash.Value >
PriceOfItem and script.Parent.Parent.Purchased.Value == false then
and you do need the wait for cash function