I have tried to modify parts from similar freemodels scripts but they work only in studio mode and not while playing the game from roblox client.The intended funtion is to spawn a model once when clicked with the tool.Here is what i have(note that this only works in studio testing and not in roblox client in-game):
bin = script.Parent
function onButton1Down(mouse)
1 local model = bin.tent:clone() 2
3 model.Parent = game.Workspace 4 model:MakeJoints() 5 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)