Hi, i’m wan’t to make pets in my game, and i wan’t to make player can equip multiple pets at the same time. Problem is i don’t know how to start, or how to make pet grid that updates when player unequips pet and equip its again, anyone know how to do that and can explain me this?
Hi, what’s a pet grid system? Are you talking about a grid layout inventory UI thing? If so, try the UIGridLayout class. Your UI script should react to changes in your inventory system and make and modify clones of a list-entry “prefab” to populate the inventory UI.
Could you post a screenshot or a drawing showing what you’re trying to create?
i’m talking about pet grid in workspace, i mean pets positions, you know, something like PSX pets when you equips this, i can’t make physical version of this.
Looks like some kind of inventory UI but using 3D elements to show the pet models. You could use a ViewportFrame to show models in a GUI object, but be aware that the lighting in ViewportFrames is very limited compared to in Workspace
I’m mean, i don’t know how to set pets positions like grid around player
i mean something like this, pets position in unision or something like this, no Gui
@ThanksRoBama I believe what @0786ideal is trying to say is how you can have the pets aligned to the left, middle and right side… If I was to guess this seems to be a case of :PivotTo()
.
i’m tried using pivots, it doesn’t work, for clean explanation i wan’t to do pet grid, this mean i wan’t to make something like pet movement from PSX , this image represents what type of movement i trying to do, i’m don’t know how to make something like this:
You could put some Attachments inside each characters HumanoidRootPart when they spawn in, and use those to represent the pet positions. Then use AlignPosition and AlignOrientation to move the pets to the positions.
i’m have no problem with attachement , but with setting it;s position in grid, this is only problem, positions
Okay i figured that myself, here is script:
local folder = script.Parent
local PetsFolder = folder.Pets
local template = folder.Pet
local Player = folder.Player
local Count = folder.Count
local collumn = 5
local startPos = Player.Position + Vector3.new(2,0,2)
local spacing = 4
local function OnRemove()
wait(0)
for i, p in pairs(PetsFolder:GetChildren()) do
if p and p:IsA("BasePart") then
i-= 1
local x = i%collumn
local z = math.floor(i/collumn)
local newpos = startPos + Vector3.new(-x*spacing,0,z*spacing)
p.Position = newpos
end
if i == #PetsFolder:GetChildren() then
break
end
end
end
local function OnAdded(object:BasePart)
for i = 0, #PetsFolder:GetChildren()-1 do
local x = i % collumn
local z = math.floor(i/collumn)
local newPos = startPos + Vector3.new(-x*spacing,0,z*spacing)
object.Position = newPos
object.Parent.ChildRemoved:Connect(function(obj)
OnRemove()
end)
if i == #PetsFolder:GetChildren()-1 then
break
end
end
end
PetsFolder.ChildAdded:Connect(function(object)
OnAdded(object)
end)
local function OnAdd()
for i = 1, 10 do
template:Clone().Parent = PetsFolder
end
end
wait(0.5)
OnAdd()
modulus helped me a lot
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.