Hello, and I have 2 problems with my inventory system.
The first one is shown here:
I have bool value called Selected
located in template for each item.
When I try to do something with Selected
value it gives an error:
Script (not full)
local function addToFrame(pet)
local newTemplate = template:Clone()
newTemplate.Name = pet.Name
newTemplate.PetName.Text = pet.Name
newTemplate.Parent = scrollingFrame
newTemplate.RealName.Value = pet.Name
if pet:FindFirstChild("Legendary") then
newTemplate.PetName.TextColor3 = leg
end
if pet:FindFirstChild("Epic") then
newTemplate.PetName.TextColor3 = epic
end
if pet:FindFirstChild("Rare") then
newTemplate.PetName.TextColor3 = rare
end
if pet:FindFirstChild("Common") then
newTemplate.PetName.TextColor3 = comm
end
newTemplate.TextButton.MouseButton1Click:Connect(function()
newTemplate.WarningFrame.Visible = true
end)
newTemplate.WarningFrame.Yes.MouseButton1Click:Connect(function()
game.ReplicatedStorage.DeletePet:FireServer(pet.Name)
newTemplate:Destroy()
end)
newTemplate.WarningFrame.No.MouseButton1Click:Connect(function()
newTemplate.WarningFrame.Visible = false
end)
local newPet = pet:Clone()
newPet.Parent = newTemplate.ViewportFrame
local camera = Instance.new("Camera")
camera.CFrame = CFrame.new(newPet.Handle.Position + (newPet.Handle.CFrame.lookVector * 3),newPet.Handle.Position)
camera.Parent = newTemplate.ViewportFrame
newTemplate.ViewportFrame.CurrentCamera = camera
buttonConnections[#buttonConnections+1] = newTemplate.MouseButton1Click:Connect(function()
if script.MultiDelete.Value == true then
--if newTemplate.Selected.Value == false then
--newTemplate.Selected.Value = true
print("select: "..newTemplate.Selected.Value)
newTemplate.BackgroundColor3 = Color3.fromRGB(255, 139, 139)
local newValue = Instance.new("StringValue")
newValue.Name = newTemplate.RealName.Value
newValue.Parent = script.MultiDelete
--end
--elseif script.MultiDelete.Value == true then
--if newTemplate.Selected.Value == true then
--newTemplate.Selected.Value = false
--newTemplate.BackgroundColor3 = Color3.fromRGB(43, 43, 43)
--script.MultiDelete:FindFirstChild(newTemplate.RealName.Value):Destroy()
--end
end
if newTemplate.Equipped.Text == "EQUIPPED" and script.MultiDelete.Value == false then
game.ReplicatedStorage.UnequipPet:FireServer(pet)
newTemplate.Name = "UnequippedItem"
newTemplate.Equipped.Text = "UNEQUIPPED"
newTemplate.BackgroundColor3 = Color3.fromRGB(43, 43, 43)
newTemplate.Equipped.TextColor3 = Color3.fromRGB(255, 255, 255)
else
if plr.EquippedPet.Value == "" and script.MultiDelete.Value == false then
game.ReplicatedStorage.EquipPet:FireServer(pet.Name, "EquippedPet")
setTemplateEquipped(newTemplate, 1, pet.Name)
end
if plr.EquippedPet_2.Value == "" and plr.EquippedPet.Value ~= "" and script.MultiDelete.Value == false then
game.ReplicatedStorage.EquipPet:FireServer(pet.Name, "EquippedPet_2")
setTemplateEquipped(newTemplate, 2, pet.Name)
end
if plr.EquippedPet_3.Value == "" and plr.EquippedPet_2.Value ~= "" and plr.EquippedPet.Value ~= "" and script.MultiDelete.Value == false then
game.ReplicatedStorage.EquipPet:FireServer(pet.Name, "EquippedPet_3")
setTemplateEquipped(newTemplate, 3, pet.Name)
end
end
end)
end
The error is at this line:
print("select: "..newTemplate.Selected.Value)
The second bug is shown here:
When I change cell padding of scrolling frame it’s just looks soo weird, the cell padding I use:
gridLayout.CellSize = UDim2.new(0.2, 0, 0.37, 0)
it fixes only when I change it to offset.
There’s the explorer:
UIGridLayout’s Properties:
How it should look like:
Thanks for the help