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

I've tried to create a car spawn tool using free model & i need help?

Asked by 9 years ago

Hello,

Basically, what I was looking for was... Let's say that there is a part I have a tool and I select the tool. And I then click on the part (with tool selected) and the car spawns on top of the part.

I found a free model and I've tried changing it spawn a car, but I cannot.

Here is the original script under the tool: -----v

bin = script.Parent

function onButton1Down(mouse)

local model = bin.TestFigure:clone() 

model.Parent = game.Workspace
model:MakeJoints()
model:MoveTo(mouse.hit.p)

end

function onSelected(mouse) mouse.Icon = "rbxasset://textures\ArrowCursor.png" mouse.Button1Down:connect(function() onButton1Down(mouse) end) end

bin.Selected:connect(onSelected)


Thank you for reading. :-) ~~Mechanizationized

1 answer

Log in to vote
0
Answered by
woodengop 1134 Moderation Voter
9 years ago

There is a mistake in line 5, You put :MoveTo and MoveTo is not a valid member of Part, so I changed it using your script, I used the CFrame(CFrame.new):

bin = script.Parent

function onButton1Down(mouse)
local model = bin.TestFigure:clone()
model.Parent = game.Workspace
model:MakeJoints()
model.CFrame=CFrame.new(mouse.hit.p)--  <---
end

function onSelected(mouse) 
mouse.Icon = "rbxasset://textures\ArrowCursor.png"
mouse.Button1Down:connect(function() 
onButton1Down(mouse)
end)
end

bin.Selected:connect(onSelected)

Hope this helps!

Ad

Answer this question