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.
01 | repeat wait() until game.Players.LocalPlayer.Character |
02 | local character = game.Players.LocalPlayer.Character |
03 | local Handle = game.ReplicatedStorage [ 'Torch' ] :Clone() |
04 | local Fire = game.ReplicatedStorage [ 'FireForTheTorch' ] :Clone() |
05 | local UIS = game:GetService( 'UserInputService' ) |
06 | local cooldown = true |
07 | local otherdown = true |
08 | local animation = Instance.new( 'Animation' ) |
09 | local buttondown = true |
10 | wait() |
11 | UIS.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 |
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
01 | local Player = game.Players.LocalPlayer |
02 | local Mouse = Player:GetMouse() |
03 |
04 | Mouse.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 |
11 | end ) |
And For Unequip put in
01 | local Player = game.Players.LocalPlayer |
02 | local Mouse = Player:GetMouse() |
03 |
04 | Mouse.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 |
13 | end ) |
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