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

How would i change this inventory to show decal instead of name?

Asked by
nicros 165
9 years ago

so im very noob at LUA and am slowly making an rpg :P

ive been grabbing free models/scripts from roblox and mixing them and editing them to fit my liking but im stuck....

im working on an inventory system and found a script that puts roblox's current inventory and hotbar into a wierd little box you can use but it shows item name and i dont want that...what i want is for it to show the items decal that it uses for roblox's hotbar i hope thats clear enough to understand

here is the local script for the inventory im using

player = game.Players.LocalPlayer

game.StarterGui:SetCoreGuiEnabled('Backpack',false)

--
local Enabled = false


function UpdateInventory()
    if Enabled == false then
        Enabled = true
        script.Parent.Frame.Visible = true
        script.Parent.Frame.CanvasSize = UDim2.new(0,0,0,20*#player.Backpack:children())
        script.Parent.Frame:ClearAllChildren()
        for i,v in pairs(player.Backpack:GetChildren()) do
            Obj1 = Instance.new('TextButton',script.Parent.Frame)
            Obj1.Size = UDim2.new(1,-12,0,20)
            Obj1.Position = UDim2.new(0,0,0,20*i-20)
            Obj1.BackgroundTransparency = 1
            Obj1.FontSize = 'Size24'
            Obj1.Text = v.Name
            Obj1.Font = 'SourceSansBold'
            Obj1.TextColor3 = Color3.new(255,255,255)
            Obj1.TextXAlignment = 'Left'
            Obj1.MouseButton1Down:connect(function()
                player.Character.Humanoid:UnequipTools()
                player.Character.Humanoid:EquipTool(v)
            end)
        end
    else
        Enabled = false
        script.Parent.Frame.Visible = false
    end
end

script.Parent.InvenButton.MouseButton1Down:connect(function()
    UpdateInventory()
end)

player.Backpack.Changed:connect(function()
    if Enabled == false then Enabled = true UpdateInventory() end
    if Enabled == true then Enabled = false UpdateInventory() end
end)

if you could walk me through what things i would have to add to this script to replace the TextButton with an imagebutton that shows the items decal that would be great.

thanks :)

Answer this question