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

Fixing the joints of a vehicle spawner tool?

Hello I have a tool that when you click anywhere on the ground, it spawns a model. Problem: The car is spawned, but when I drive it, the wheels do not turn left or right.

Script:

bin = script.Parent

function onButton1Down(mouse)

	local model = bin.Car:clone()
	model.Parent = game.Workspace
	model:MakeJoints()
	model:MoveTo(mouse.hit.p)

end

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



bin.Selected:connect(onSelected)

How do I fix it? Thanks!

1 answer

Make local script in StarterPack

Here's an example that maybe you could use

	local Part =game.Workspace.Model
	playerMouse = game.Players.LocalPlayer:GetMouse()
	playerMouse.Button1Down:connect(function(Hit)
		local Part2 = Part:Clone()
		Part2.Parent = game.Workspace
		Part2:MakeJoints()
		local x = playerMouse.Hit.X
		local y = playerMouse.Hit.Y
		local z = playerMouse.Hit.Z
		Part:MoveTo(Vector3.new(x,y,z))
	end)

2 comments

0

Ok it works, but I have to re-enter the car 3-4 times before the wheels start working. How do I fix this? Thx!

0

Actually your script does do anything. sorry

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