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

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

Asked by 9 years ago

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

Log in to vote
0
Answered by 9 years ago

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!

0
Thanks! It works great! User#9487 0 — 9y
Ad

Answer this question