Hi guys, I've been trying to get this code to work for 2 days now. This is what it's supposed to do:
- When the left mouse button is clicked, and the tool is equipped, identify vehicle pad
- Clone the bike in ReplicatedStorage(no, it's not a possibility that these parts fell off the map. I anchored all of them.)
- Place the new bike on the pad
- Unanchor the bike
- Destroy itself.
Here's the code block: (yes, this is in a localscript.)
local ADFBike = game.ReplicatedStorage["ADF Bike"]
local Tool = script.Parent
function unanchor (m)
for _,i in pairs (m:GetChildren()) do
if i:IsA("BasePart") then
i:MakeJoints()
i.Anchored = false
else
unanchor(i)
end
end
end
Tool.Equipped:connect(function (Mouse)
Mouse.Button1Up:connect(function ()
print("Activated")
local MTar = Mouse.Target
if MTar.Name == "Vehicle Pad" then
print("Determined")
local NewBike = ADFBike:Clone()
print("Cloned")
NewBike.Parent = game.Workspace
print("Parented")
NewBike:MoveTo(Mouse.Target.Position + Vector3.new(0, 5, 0))
print("Positioned")
unanchor(NewBike)
print("Unanchored")
script.Parent:Destroy()
end
end)
end)

1 comment
Which of those print statements is running?