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.
repeat wait() until game.Players.LocalPlayer.Character
local character = game.Players.LocalPlayer.Character
local Handle = game.ReplicatedStorage['Torch']:Clone()
local Fire = game.ReplicatedStorage['FireForTheTorch']:Clone()
local UIS = game:GetService('UserInputService')
local cooldown = true
local otherdown = true
local animation = Instance.new('Animation')
local buttondown = true
wait()
UIS.InputBegan:Connect(function(input, processed)
-- 'processed' will be 'true' if Roblox already handled that input.
-- We shouldn't handle it in that case.
if not processed then
if input.KeyCode == Enum.KeyCode.F then
cooldown = false
local Rhand = character:findFirstChild('RightHand')
Handle.Parent = game.Players.LocalPlayer.Character
Fire.Parent = game.Players.LocalPlayer.Character
local torso = character:findFirstChild('UpperTorso')
Handle.CFrame = Rhand.CFrame
Fire.CFrame = Rhand.CFrame
local weld = Instance.new("Weld")
weld.Part0 = Handle
weld.C0 = Handle.CFrame:inverse()
weld.Part1 = Fire
weld.C1 = Fire.CFrame:inverse()
weld.Parent = Handle
local weld2 = Instance.new("Weld")
weld2.Part0 = Rhand
weld2.C0 = Rhand.CFrame:inverse()
weld2.Part1 = Handle
weld2.C1 = Handle.CFrame:inverse()
weld2.Parent = Handle
if processed then
wait(3)
end
end
end
wait()
cooldown = true
end)
UIS.InputBegan:Connect(function(input, processed)
-- 'processed' will be 'true' if Roblox already handled that input.
-- We shouldn't handle it in that case.
if not processed then
if input.KeyCode == Enum.KeyCode.F then
otherdown = false
character:findFirstChild('Torch'):Destroy()
character:findFirstChild('FireForTheTorch'):Destroy()
end
end
wait()
otherdown = true
end)

1 comment
That should work, Hope you like it C: