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

Equip and Unequip part by pressing a button help?

Asked by 7 years ago

Hi so what i need help with is, that when i press a button a torch is clone to my hand, and so basically when you press F the torch "equips" when you press F again it "dequips" and when you press it after it "dequips" it equips and so on, but so far after dequipping it wont requip pleas help me.

01repeat wait() until game.Players.LocalPlayer.Character
02local character = game.Players.LocalPlayer.Character
03local Handle = game.ReplicatedStorage['Torch']:Clone()
04local Fire = game.ReplicatedStorage['FireForTheTorch']:Clone()
05local UIS = game:GetService('UserInputService')
06local cooldown = true
07local otherdown = true
08local animation = Instance.new('Animation')
09local buttondown = true
10wait()
11UIS.InputBegan:Connect(function(input, processed)
12    -- 'processed' will be 'true' if Roblox already handled that input.
13    -- We shouldn't handle it in that case.
14    if not processed then
15        if input.KeyCode == Enum.KeyCode.F then
View all 58 lines...

1 answer

Log in to vote
0
Answered by 7 years ago

I have found a simpler way of doing this, First put 2 localscripts inside StarterGui, then call one of them Equip and the other Unequip, For Equip put in

01local Player = game.Players.LocalPlayer
02local Mouse = Player:GetMouse()
03 
04Mouse.KeyDown:connect(function(Key)
05        Key = Key:lower()
06        if Key == 'f' then
07    game.Workspace:FindFirstChild(Player.Name).Humanoid:EquipTool(Player.Backpack.BigSword)
08    script.Parent.Unequip.Disabled = false
09    script.Disabled = true
10        end
11end)

And For Unequip put in

01local Player = game.Players.LocalPlayer
02local Mouse = Player:GetMouse()
03 
04Mouse.KeyDown:connect(function(Key)
05        Key = Key:lower()
06        if Key == 'f' then
07    game.Workspace:FindFirstChild(Player.Name).BigSword:remove()
08    game.ReplicatedStorage.BigSword:clone()
09    game.ReplicatedStorage.BigSword:clone().Parent = game.Players.LocalPlayer.Backpack
10    script.Parent.Equip.Disabled = false
11    script.Disabled = true
12        end
13end)

Tho you will have to change a few things: Button ( if u want) Tool name (Where it says BigSword) And also put the tool you want in Replicated Storage

0
That should work, Hope you like it C: lukebloxdaily 6 — 7y
Ad

Answer this question