Hi, I have some problems to make a user take an item when they pressed E. Can you give me tips how i could make it more efficient/better? Im still a beginner in scripting
function HoverButton(text, b)
if b == true then
hoverbutton.Text = text
hoverbutton.Visible = true
else
hoverbutton.Visible = false
end
game:GetService("RunService").RenderStepped:Connect(function()
uis.InputBegan:Connect(function(key, gameProcessedEvent)
if key.KeyCode == Enum.KeyCode.E then
if mouse.Target then
if debounce == false then
debounce = true
mt = mouse.Target
if mouse.Target.Name == "Metal" then
mi:FireServer(mt)
item = takeitem:InvokeServer(mt)
_G.PutInBackpack(item)
end
wait(0.1)
debounce = false
end
end
end
end)
if mouse.Target then
debo = true
if mouse.Target.Name == "Metal" then
HoverButton("[E] Take", true)
else
HoverButton("", false)
end
end
end
end)
