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

01local player = game.Players.LocalPlayer --Assuming the script is a localscript, you can shorten this.
02local cost = 15000
03 
04script.Parent.MouseButton1Click:connect(function()
05    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.
06    local money = leaderstats:FindFirstChild("Money")
07    if money.Value >= cost then
08        local spawncar = game.ReplicatedStorage.Vehicles["Camaro 2017"]:Clone()
09        spawncar.Parent = workspace
10        money.Value = money.Value - 15000
11        script.Parent.Text = "Bought"
12       script.Disabled = true
13   else
14       script.Parent.FontSize = 20
15       script.Parent.Text = "Not enough $"
16    end
17end)

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