Firstly:
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Parent.Parent.Sound:Play()
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
script.Parent.Text = "Spawn"
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Parent.Visible = false
script.Parent.Parent.Parent.Parent.Open.Text = "Spawn A Bus"
end)
end
end
end)
The output error is: SeverStorage is not a valid member of DataModel, that error happens at line 9:
local PriceOfItem = game.ReplicatedStorage:WaitForChild("CheckPrice"):InvokeServer(script.Parent.Parent.Name)
Alright, I just searched up 'what is datamodel on roblox' datamodel is just a fancy way to say "game." Before you say it, yes SeverStorage is named SeverStorage on this place, buts its still not cooperating. Thanks!

1 comment
If this does not work try renaming SeverStorage to just Serverstorage