This script constantly loops the part where its meant to create a gui.
Script(Local) -
repeat wait() until game.Players.LocalPlayer:FindFirstChild('DataLoaded')
local a = game:GetService('StarterGui')
a:SetCoreGuiEnabled('Backpack',false)
local userinputservice = game:GetService("UserInputService")
local sprinting = false
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local srpit = false
local counter = 0
local place = 0
local row = 0
function sans(v)
print(v.Name)
if v:FindFirstChild('Keycode') then
else
local frame = game.Lighting.Assets.Gui.Attack:Clone()
frame.Parent = script.Parent.List
frame.Position = UDim2.new(0.2*place,0,0,200*row)
if v:FindFirstChild('Click') then
frame.Name = "a"
print(v.Name)
frame.Text = v.Name
else
frame.Name = v.Keycode.Value
frame.Text = v.Keycode.Value
end
place = place + 1
if place == 3 then
place = 0
row = row + 1
end
end
end
function update(c)
if c:IsA('Tool') then
repeat wait() until c:FindFirstChild('Click')
if c:FindFirstChild('Click').Value == true and c.Name == "Stick" then
game.Lighting.RemoteEvents.Battle.EquipTool:FireServer(c)
mouse.Button1Down:Connect(function()
c.Attack:FireServer()
print('a')
end)
end
print('eyes')
userinputservice.InputBegan:Connect(function(input)
if c:FindFirstChild('Click') then
else
local keyBUTTON = c:WaitForChild('Keycode').Value
local xboxbutton = c.XboxButton.Value
if input.KeyCode == Enum.KeyCode[keyBUTTON] or input.KeyCode == Enum.KeyCode[xboxbutton] then
c.Attack:FireServer()
end
end
end)
end
end
function checkmana()
if game.Players.LocalPlayer.Mana.Value < 5 then
return false
end
end
game.Players.LocalPlayer.Backpack.ChildAdded:Connect(update)
game.Players.LocalPlayer.Backpack.ChildRemoved:Connect(update)
game.Players.LocalPlayer.Character.ChildAdded:Connect(update)
game.Players.LocalPlayer.Character.ChildRemoved:Connect(update)
game.Players.LocalPlayer.Character.ChildRemoved:Connect(sans)
game.Players.LocalPlayer.Backpack.ChildAdded:Connect(sans)
game.Players.LocalPlayer.Backpack.ChildRemoved:Connect(sans)