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

ROBLOX Broke my script, can someone fix it?

bin = script.Parent

function onButton1Down(mouse)

local model = bin.model:clone()

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

script.Parent:Remove()

end

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

bin.Selected:connect(onSelected)

2 answers

✓ Accepted answer

Let's see..

wait(0.1)
bin = script.Parent

function onButton1Down(mouse)
	local model = bin.model:clone()
	
	model.Parent = game.Workspace
	model:MakeJoints()
	model:MoveTo(mouse.Hit.p)
	
	script.Parent:Destroy()
end

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

bin.Selected:connect(onSelected)

Try it out, and say if it works or not.

Also, if it's a regular script, then the script won't work in a hopperbin because of an update 2-3 months ago (just noting that).

Use a LocalScript instead if it isn't already.

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