i want it so when you click the button it dis-equips you wepon.
COMMUNITY QUESTION
Clicking the Button dis-equips you wepon?
2 answers
You can unequip the player's tool by parenting it back from their character to their backpack, like so:
local plr = game:GetService("Players").LocalPlayer
button.MouseButton1Click:Connect(function()
for i,v in pairs(plr.Character:GetChildren()) do
if v.ClassName == "Tool" then
v.Parent = plr:FindFirstChildOfClass("Backpack") or plr:WaitForChild("Backpack")
end
end
end)
You can use the :UnequipTools() method on the Humanoid of the player's character to achieve this.
-- in a LocalScript
-- local button = workspace.Button
local plr = game:GetService("Players").LocalPlayer
button.MouseButton1Click:Connect(function() -- when dey clik it
plr.Character.Humanoid:UnequipTools() -- poof no moar toolz
end
3 comments
0
workspace.Button? wat :thinking:
0
just an example
0
of what the "button" variable might be
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
You know.. roblox made something called humanoid:UnequipTools()...