Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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

0
Explique moi en français ce que tu veux faire et je te répondrais ce que je sais NiniBlackJackQc 1562 — 6y
0
Ce n'est pas un site de demande. De plus, expliquez en détail ce que vous essayez de faire. hiimgoodpack 2009 — 6y

1 answer

Log in to vote
0
Answered by
2eggnog 981 Moderation Voter
6 years ago
Edited 6 years ago

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)
Ad

Answer this question