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

I have the script to spawn cars works everything but the car not why?

Asked by 5 years ago
Edited 5 years ago

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?

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 User#20279 0 — 5y
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? HenriqueHome31 22 — 5y
0
I dont need more i make script and works thx bro HenriqueHome31 22 — 5y

Answer this question