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

My car spawn script doesn't work. Help please?

The script does make my car spawn, but it doesn't spawn at the character's location. I get an error saying: "Position is not a valid member of Model 13:10:43.961 - Script 'Players.Player.PlayerGui.ScreenGui.Frame.TextButton.Script', Line 7 13:10:43.962 - Stack End" How can I get around this? The model is this: http://www.roblox.com/1983-Toyota-Sprinter-Trueno-GT-APEX-SS3-57-item?id=293696178

And here's the script:

function onClick()
local ae = game.Lighting.ae
local name = game.Players.LocalPlayer.Name
local char = game.Workspace:FindFirstChild(name)
local c = game.Lighting.ae:Clone()
c.Parent = game.Workspace
c.Position = Vector3.new(char.Torso)
end

script.Parent.MouseButton1Click:connect(onClick)

Thank you.

1 answer

✓ Accepted answer

Don't use position use the function, :MoveTo() example:

function onClick()
local ae = game.Lighting.ae
local name = game.Players.LocalPlayer.Name
local char = game.Workspace:FindFirstChild(name)
local c = game.Lighting.ae:Clone()
c.Parent = game.Workspace
--c.Position = Vector3.new(char.Torso) change this line to,
c:MoveTo(char.Torso.Position + Vector3.new(0, 2, 0))
end

script.Parent.MouseButton1Click:connect(onClick)

If this helps or works, can you accept my answer? It gives us both rep!

1 comment

0

Thanks! It works great!

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