Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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)

2 comments

0

WaitForChild("leaderstats"):WaitForChild("Cash")

0

This script looks very outdated and you should try a different tutorial.

1 answer

✓ Accepted answer

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

2 comments

0

Your answer will not even work. You're not using Clone correctly. It should be :Clone()

0

ye i forgot that when i typed

This discussion is preserved as it was. New answers, comments, and votes are closed.