This is the script I put here in Button in UI

local player = game.Players.LocalPlayer --Assuming the script is a localscript, you can shorten this.
local cost = 15000

script.Parent.MouseButton1Click:connect(function()
    local leaderstats = player:FindFirstChild("leaderstats") --You don't need nearly as many if statements as you had, since if the code results in error, it will stop running and can be recalled when the button is pressed again.
    local money = leaderstats:FindFirstChild("Money")
    if money.Value >= cost then
        local spawncar = game.ReplicatedStorage.Vehicles["Camaro 2017"]:Clone()
        spawncar.Parent = workspace
        money.Value = money.Value - 15000
        script.Parent.Text = "Bought"
       script.Disabled = true
   else
       script.Parent.FontSize = 20
       script.Parent.Text = "Not enough $"
    end
end)

The problem is that everything works except when I get in the car it seems that there is no DriveSeat. does anyone know why?

3 comments

0

You're cloning the car locally. That means only you can see the car and server (normal) scripts inside the car may break. You should use remote events to clone the car on the server : https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events

0

so I have to change the script too right? i have no idea how to do i'm not a good for you make script for me?

0

I dont need more i make script and works thx bro