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

Equipping Tools [closed]

Asked by 10 years ago

I disabled the inventory gui so I had to create my own keys to navigate through your tools. It works well but a player can repeatedly hit 1 and they will keep getting a sword.

Here's the script:

wait()

local p = game.Players.LocalPlayer
local h = p.Character.Humanoid
local e = p:GetMouse()
local down = false

e.KeyDown:connect(function(key)
if key:lower() == "1" then
down = true
p.Backpack.LinkedSword:Clone().Parent = p.Character
a=p.Character:FindFirstChlid("PaintballGun")
if a then
a:destroy()
end
end
end)

e.KeyUp:connect(function(key)
if key:lower() == "2" then
down = true
p.Backpack.PaintballGun:Clone().Parent = p.Character
b=p.Character:FindFirstChlid("LinkedSword")
if b then
b:destroy()
end
end
end)

Closed as Not Constructive by evaera, chess123mate, and TheHospitalDev

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?