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

Title : Non-tool model gun... How ?

How do I make a model (Gun) function like a tool by pressing a button in a Gui (If you want some exemple: Phantom forces you deploy you get your gun you can shoot with it and everyting put it's just a model)

I'm sorry if you have trouble to understand my post, because french is my main language

2 comments

0

Explique moi en français ce que tu veux faire et je te répondrais ce que je sais

0

Ce n'est pas un site de demande. De plus, expliquez en détail ce que vous essayez de faire.

1 answer

Connect the button event to a function which equips/dequips the model by placing it in your character and welding it. Then, you can use the UserInputService to detect mouse clicks and whatnot.

Here's a rough skeleton to get you started. Note that this won't work for filtering enabled games.

function equipTool()
	tool = toolModel:Clone()
	tool.Parent = character
	--Do some welding
end
function dequipTool()
	tool:Destroy()
end
button.MouseButton1Click:connect(function()
	if equipped then
		equipTool()
	else
		unequipTool()
	end
end)
game:GetService("UserInputService").InputBegan:Connect(function(input)
	if input.UserInputType == "MouseButton1" then
		--Fire the weapon
	end
end)

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