Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

"Cash is not a valid member of Folder" Car Spawner?

Asked by 5 years ago

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)
0
WaitForChild("leaderstats"):WaitForChild("Cash") DeceptiveCaster 3761 — 5y
0
This script looks very outdated and you should try a different tutorial. popeeyy 493 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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

0
Your answer will not even work. You're not using Clone correctly. It should be :Clone() namespace25 594 — 5y
0
ye i forgot that when i typed Gameplayer365247v2 1055 — 5y
Ad

Answer this question