hi robloxians,
i just made egg hatching system but i dont know how can i make my egg hatching system like this when you open the egg:
https://gyazo.com/205fd58d1bc189c7794386ae441016ed
https://gyazo.com/7e8cb8829d9396003960d57ab6543277
can somebody help me how they doing this? (ViewPortFrame no let me to do this effects)
thanks for help,
REALINONOOBYT.
That’s most likely made using a ViewportFrame, or at least I would use it. Or then it’s just an image which is scripted to shake.
but when im trying to use ViewPortFrame is no let me to do this effects. did you look at the gifs?
Not sure about the first one, the second one is definitely a ViewportFrame though, you should read up on it, it shows a tutorial on how to get it working. The one in @Dev_Kittenz’ post was a good example.
thanks, but how i can actually get my ui to get under the player same as the seond or first video.
Not sure, that’s why I said I wasn’t sure about the first one. If I had to guess, it would be BillboardGuis.
and then if i will use billboardGuis i will be able to make their CFrame with the player camera CFrame?
I’m not sure if you’d even have to do that. It might just be a child of the torso, there are some properties to move it around, looks like those were taken advantage of.
This looks like it was done with an old Model3D module by TheNexusAvenger. Module3D V6.1 (ViewportFrame Implementation).
Before it had ViewportFrame implementation it would basically warp models to a certain size and position it in front of the camera based on your screen ratio so it gave off the effect that you were looking at a 3D but 2 dimensional GUI object– which is why there is clipping on the object as you get closer to your character. This is avoidable using ViewportFrames. There’s many ways and methods you can go about “shaking” the egg. You can manipulate the camera of a ViewportFrame to give off a shake effect.
I would recommend looking through the ROBLOX API for more information on how ViewportFrames work. Now ROBLOX has added in a “WorldObject” instance which actually helps in adding in simple physics to your ViewportFrame worlds, and can benefit you in creating the effect you’re looking for.
Good luck.
thank you for the help @Ocula, i tried to use this but when i buy the egg then is no show me the egg here is the script:
local event = game.ReplicatedStorage:WaitForChild("KeyBind")
function event:OnServerInvoke(Player, tier,key)
local suffixes = {'','K','M','B','T','qd','Qn','sx','Sp','O','N','de','Ud','DD','tdD','qdD','QnD','sxD','SpD','OcD','NvD','Vgn','UVg','DVg','TVg','qtV','QnV','SeV','SPG','OVG','NVG','TGN','UTG','DTG','tsTG','qtTG','QnTG','ssTG','SpTG','OcTG','NoAG','UnAG','DuAG','TeAG','QdAG','QnAG','SxAG','SpAG','OcAG','NvAG','CT'}
local function format(val)
for i=1, #suffixes do
if tonumber(val) < 10^(i*3) then
return math.floor(val/((10^((i-1)*3))/100))/(100)..suffixes[i]
end
end
end
local id = 0
local TS = game:GetService("TweenService")
local RS = game:GetService("ReplicatedStorage")
local Library = RS:WaitForChild("View")
local Eggs = require(RS:WaitForChild("Eggs"))
local Data = Eggs[tostring(tier)]
local rarity = require(game.ReplicatedStorage.Rarity)
local module = require(game.ReplicatedStorage:WaitForChild("PETS"))
local Cost = Data["Cost"]
local Pets = Data["Pets"]
local Tier = script.Parent:WaitForChild(tostring(tier))
local Egg = Tier:WaitForChild("Egg")
local TotalWeight = 0
for i,v in pairs(Pets) do
TotalWeight = TotalWeight + v[1]
end
local function RotateTween(Obj,Rot, Size)
local TI = TweenInfo.new(.5,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out)
local Propertiers = {
Rotation = Rot;
Size = Size;
}
local Tween = TS:Create(Obj,TI,Propertiers)
Tween:Play()
end
local function ChoosePet(Player)
local Chance = math.random(1,TotalWeight)
local Counter = 0
for i,v in pairs(Pets) do
Counter = Counter+v[1]
if Chance <= Counter then
return i
end
end
end
if key == true then
local Stats = Player:WaitForChild("leaderstats")
local Coins = Stats:WaitForChild("Money")
local PetInv = Player:WaitForChild("Pets")
if Player:FindFirstChild("DebPet") then return end
local Counter = 0
for i,v in pairs(PetInv:GetChildren()) do
Counter=Counter+v.Value
end
if Coins.Value >= Cost*3 then
if Counter >= 50 and game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, id) then
local pgUI = Player:WaitForChild("PlayerGui")
local GUI = pgUI:WaitForChild("Main")
local PN = script:WaitForChild("Full"):Clone()
PN.Parent = GUI
wait(2)
PN:Destroy()
elseif Counter >= 20 and not game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, id) then
local pgUI = Player:WaitForChild("PlayerGui")
local GUI = pgUI:WaitForChild("Main")
local PN = script:WaitForChild("Full"):Clone()
PN.Parent = GUI
wait(2)
PN:Destroy()
elseif Counter <= 17 and not game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, id) or Counter <= 47 and game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, id) then
local debounce = Instance.new("BoolValue")
debounce.Name = "DebPet"
debounce.Parent = Player
Coins.Value = Coins.Value - Cost*3
local main = Player:WaitForChild("Main")
local eggCount = main:WaitForChild("EggsQ1")
eggCount.Value = eggCount.Value + 3
for i,v in pairs(Player:WaitForChild("PlayerGui"):GetChildren())do
if v:IsA("ScreenGui") and v.Name ~= "Main" and v.Name ~= "ToolPopUp" then
v.Enabled = false
end
end
local PetChosen1,PetChosen2,PetChosen3 = ChoosePet(),ChoosePet(),ChoosePet()
local pgUI = Player:WaitForChild("PlayerGui")
local GUI = pgUI:WaitForChild("Main")
local Frame = Instance.new("Frame")
Frame.Size = UDim2.new(1,0,1,0)
Frame.BackgroundTransparency = 1
Frame.Position = UDim2.new(0,0,0,0)
local ViewPort1,ViewPort2,ViewPort3 = Instance.new("ViewportFrame"),Instance.new("ViewportFrame"),Instance.new("ViewportFrame")
ViewPort1,ViewPort2,ViewPort3.Ambient = Color3.fromRGB(255,255,255),Color3.fromRGB(255,255,255),Color3.fromRGB(255,255,255)
ViewPort1,ViewPort2,ViewPort3.LightColor = Color3.fromRGB(255,255,255),Color3.fromRGB(255,255,255),Color3.fromRGB(255,255,255)
ViewPort1,ViewPort2,ViewPort3.ZIndex = 0,0,0
local PetInv = Player:WaitForChild("Pets")
PetInv:WaitForChild(PetChosen1).Value = PetInv:WaitForChild(PetChosen1).Value +1
PetInv:WaitForChild(PetChosen2).Value = PetInv:WaitForChild(PetChosen2).Value +1
PetInv:WaitForChild(PetChosen3).Value = PetInv:WaitForChild(PetChosen3).Value +1
ViewPort1.Size,ViewPort2.Size,ViewPort3.Size = UDim2.new(0,260,0,500),UDim2.new(0,282,0,500),UDim2.new(0,260,0,500)
ViewPort1.Position,ViewPort2.Position = UDim2.new(0.333,0,0,0),UDim2.new(0.653,0,0,0),UDim2.new(0,0,0,0)
ViewPort1.BackgroundTransparency = 1 ViewPort2.BackgroundTransparency = 1 ViewPort3.BackgroundTransparency = 1
local EggClone1,EggClone2,EggClone3 = Egg:Clone(),Egg:Clone(),Egg:Clone()
local Pos1,Pos2,Pos3 = EggClone1.Position,EggClone2.Position,EggClone3.Position
EggClone1.Parent,EggClone2.Parent,EggClone3.Parent = workspace.CurrentCamera, workspace.CurrentCamera, workspace.CurrentCamera
local Camera1,Camera2,Camera3 = Instance.new("Camera"),Instance.new("Camera"),Instance.new("Camera")
Camera1.Parent,Camera2.Parent,Camera3.Parent = workspace,workspace,workspace
ViewPort1.CurrentCamera,ViewPort2.CurrentCamera,ViewPort3.CurrentCamera = Camera1,Camera2,Camera3
Camera1.CFrame,Camera2.CFrame,Camera3.CFrame = CFrame.new(Vector3.new(Pos1.X,Pos1.Y,Pos1.Z+7),Pos1),CFrame.new(Vector3.new(Pos2.X,Pos2.Y,Pos2.Z+7),Pos2),CFrame.new(Vector3.new(Pos3.X,Pos3.Y,Pos3.Z+7),Pos3)
local module = require(game.ReplicatedStorage:WaitForChild("PETS"))
local rare1,rare2,rare3 = script:WaitForChild("Rarity"):Clone(),script:WaitForChild("Rarity"):Clone(),script:WaitForChild("Rarity"):Clone()
if rarity.Pets[tonumber(PetChosen1)] == "Legendary" then rare1.TextColor3 = Color3.fromRGB(255, 255, 0) end if rarity.Pets[tonumber(PetChosen2)] == "Legendary" then rare2.TextColor3 = Color3.fromRGB(255, 255, 0) end if rarity.Pets[tonumber(PetChosen3)] == "Legendary" then rare3.TextColor3 = Color3.fromRGB(255, 255, 0) end if rarity.Pets[tonumber(PetChosen1)] == "Common" then rare1.TextColor3 = Color3.fromRGB(62, 81, 255) end if rarity.Pets[tonumber(PetChosen2)] == "Common" then rare2.TextColor3 = Color3.fromRGB(62, 81, 255) end if rarity.Pets[tonumber(PetChosen3)] == "Common" then rare3.TextColor3 = Color3.fromRGB(62, 81, 255) end if rarity.Pets[tonumber(PetChosen1)] == "Rare" then rare1.TextColor3 = Color3.fromRGB(255, 24, 24) end if rarity.Pets[tonumber(PetChosen2)] == "Rare" then rare2.TextColor3 = Color3.fromRGB(255, 24, 24) end if rarity.Pets[tonumber(PetChosen3)] == "Rare" then rare3.TextColor3 = Color3.fromRGB(255, 24, 24) end if rarity.Pets[tonumber(PetChosen1)] == "Epic" then rare1.TextColor3 = Color3.fromRGB(206, 0, 155) end if rarity.Pets[tonumber(PetChosen2)] == "Epic" then rare2.TextColor3 = Color3.fromRGB(206, 0, 155) end if rarity.Pets[tonumber(PetChosen3)] == "Epic" then rare3.TextColor3 = Color3.fromRGB(206, 0, 155) end
local nm1,nm2,nm3 = script:WaitForChild("NOME"):Clone(),script:WaitForChild("NOME"):Clone(),script:WaitForChild("NOME"):Clone()
nm1.Text,nm2.Text,nm3.Text = module.Pets[tonumber(PetChosen1)],module.Pets[tonumber(PetChosen2)],module.Pets[tonumber(PetChosen3)]
rare1.Text,rare2.Text,rare3.Text = rarity.Pets[tonumber(PetChosen1)] ,rarity.Pets[tonumber(PetChosen2)],rarity.Pets[tonumber(PetChosen3)]
Frame.Parent = GUI
ViewPort1.Parent,ViewPort2.Parent,ViewPort3.Parent = Frame,Frame,Frame
wait(1)
for i=1,5 do
RotateTween(ViewPort1,25)
RotateTween(ViewPort2,25)
RotateTween(ViewPort3,25)
wait(.1)
RotateTween(ViewPort1,-25)
RotateTween(ViewPort2,-25)
RotateTween(ViewPort3,-25)
wait(.1)
end
RotateTween(ViewPort1,0)
RotateTween(ViewPort2,0)
RotateTween(ViewPort3,0)
wait(.5)
EggClone1:Destroy() EggClone2:Destroy() EggClone3:Destroy()
nm1.Parent,nm2.Parent,nm3.Parent = workspace.CurrentCamera,workspace.CurrentCamera,workspace.CurrentCamera
local PetClone1,PetClone2,PetClone3 = Library:WaitForChild(PetChosen1):Clone(),Library:WaitForChild(PetChosen2):Clone(),Library:WaitForChild(PetChosen3):Clone()
local HeadPos1,HeadPos2,HeadPos3 = PetClone1.Position,PetClone2.Position,PetClone3.Position
Camera1.CFrame = CFrame.new(Vector3.new(HeadPos1.X,HeadPos1.Y,HeadPos1.Z+7),HeadPos1) Camera2.CFrame = CFrame.new(Vector3.new(HeadPos2.X,HeadPos2.Y,HeadPos2.Z+7),HeadPos2) Camera3.CFrame = CFrame.new(Vector3.new(HeadPos3.X,HeadPos3.Y,HeadPos3.Z+7),HeadPos3)
PetClone1.Parent,PetClone2.Parent,PetClone3.Parent = workspace.CurrentCamera,workspace.CurrentCamera,workspace.CurrentCamera
rare1.Parent,rare2.Parent,rare3.Parent = workspace.CurrentCamera,workspace.CurrentCamera,workspace.CurrentCamera
if Player:FindFirstChild("Discovered") and Player.Discovered:FindFirstChild(tostring(PetChosen1)) and Player.Discovered[tostring(PetChosen1)].Value == false then Player.Discovered[tostring(PetChosen1)].Value = true script:WaitForChild("Discovered"):Clone().Parent = ViewPort1 end if Player:FindFirstChild("Discovered") and Player.Discovered:FindFirstChild(tostring(PetChosen2)) and Player.Discovered[tostring(PetChosen2)].Value == false then Player.Discovered[tostring(PetChosen2)].Value = true script:WaitForChild("Discovered"):Clone().Parent = ViewPort2 end if Player:FindFirstChild("Discovered") and Player.Discovered:FindFirstChild(tostring(PetChosen3)) and Player.Discovered[tostring(PetChosen3)].Value == false then Player.Discovered[tostring(PetChosen3)].Value = true script:WaitForChild("Discovered"):Clone().Parent = ViewPort3 end
wait(2)
Frame:Destroy()
debounce:Destroy()
for i,v in pairs(Player:WaitForChild("PlayerGui"):GetChildren())do
if v:IsA("ScreenGui") and v.Name ~= "Main" and v.Name ~= "ToolPopUp" then
v.Enabled = true
end
end
else
local pgUI = Player:WaitForChild("PlayerGui")
local GUI = pgUI:WaitForChild("Main")
local PN = script:WaitForChild("3pet"):Clone()
PN.Parent = GUI
wait(2)
PN:Destroy()
end
else
local pgUI = Player:WaitForChild("PlayerGui")
local GUI = pgUI:WaitForChild("Main")
local PN = script:WaitForChild("NoCoins"):Clone()
PN.Parent = GUI
wait(2)
PN:Destroy()
end
else
local Stats = Player:WaitForChild("leaderstats")
local Coins = Stats:WaitForChild("Coins")
local PetInv = Player:WaitForChild("Pets")
if Player:FindFirstChild("DebPet") then return end
local Counter = 0
for i,v in pairs(PetInv:GetChildren()) do
Counter=Counter+v.Value
end
if Coins.Value >= Cost then
if Counter >= 50 and game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, id) then
local pgUI = Player:WaitForChild("PlayerGui")
local GUI = pgUI:WaitForChild("Main")
local PN = script:WaitForChild("Full"):Clone()
wait(2)
PN:Destroy()
elseif Counter >= 20 and not game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, id) then
local pgUI = Player:WaitForChild("PlayerGui")
local GUI = pgUI:WaitForChild("Main")
local PN = script:WaitForChild("Full"):Clone()
PN.Parent = GUI
wait(2)
PN:Destroy()
else
local debounce = Instance.new("BoolValue")
debounce.Name = "DebPet"
debounce.Parent = Player
Coins.Value = Coins.Value - Cost
local main = Player:WaitForChild("Main")
local eggCount = main:WaitForChild("EggsQ1")
eggCount.Value = eggCount.Value + 1
for i,v in pairs(Player:WaitForChild("PlayerGui"):GetChildren())do
if v:IsA("ScreenGui") and v.Name ~= "Main" and v.Name ~= "ToolPopUp" then
v.Enabled = false
end
end
local PetChosen = ChoosePet(Player)
local pgUI = Player:WaitForChild("PlayerGui")
local GUI = pgUI:WaitForChild("Main")
local ViewPort = Instance.new("ViewportFrame")
local PetInv = Player:WaitForChild("Pets")
local Module3D = require(Player.PlayerGui.Module3D)
local Frame = ViewPort
PetInv:WaitForChild(PetChosen).Value = PetInv:WaitForChild(PetChosen).Value +1
ViewPort.Size = UDim2.new(1,0,1,0)
ViewPort.BackgroundTransparency = 1
local EggClone = Egg:Clone()
local Pos = EggClone.Position
Module3D = Module3D:Attach3D(Frame, EggClone)
Module3D:SetActive(true)
EggClone.Parent = ViewPort
local Camera = Instance.new("Camera")
Camera.Parent = ViewPort
ViewPort.CurrentCamera = Camera
Camera.CFrame = CFrame.new(Vector3.new(Pos.X,Pos.Y,Pos.Z+7),Pos)
local module = require(game.ReplicatedStorage:WaitForChild("PETS"))
local nm,rare = script:WaitForChild("NOME"):Clone(),script:WaitForChild("Rarity"):Clone()
if rarity.Pets[tonumber(PetChosen)] == "Legendary" then rare.TextColor3 = Color3.fromRGB(255, 255, 0)end if rarity.Pets[tonumber(PetChosen)] == "Common" then rare.TextColor3 = Color3.fromRGB(62, 81, 255) end if rarity.Pets[tonumber(PetChosen)] == "Rare" then rare.TextColor3 = Color3.fromRGB(255, 24, 24) end if rarity.Pets[tonumber(PetChosen)] == "Epic" then rare.TextColor3 = Color3.fromRGB(206, 0, 155) end
nm.Text,rare.Text = module.Pets[tonumber(PetChosen)],rarity.Pets[tonumber(PetChosen)]
ViewPort.Parent = GUI
wait(1)
for i=1,5 do
RotateTween(ViewPort,25)
wait(.1)
RotateTween(ViewPort,-25)
wait(.1)
end
RotateTween(ViewPort,0)
wait(.5)
EggClone:Destroy()
nm.Parent = ViewPort
local PetClone = Library:WaitForChild(PetChosen):Clone()
local HeadPos = PetClone.Position
Camera.CFrame = CFrame.new(Vector3.new(HeadPos.X,HeadPos.Y,HeadPos.Z+7),HeadPos)
PetClone.Parent,rare.Parent = ViewPort,ViewPort
if Player:FindFirstChild("Discovered") and Player.Discovered:FindFirstChild(tostring(PetChosen)) and Player.Discovered[tostring(PetChosen)].Value == false then Player.Discovered[tostring(PetChosen)].Value = true script:WaitForChild("Discovered"):Clone().Parent = ViewPort end
wait(2)
ViewPort:Destroy()
debounce:Destroy()
for i,v in pairs(Player:WaitForChild("PlayerGui"):GetChildren())do
if v:IsA("ScreenGui") and v.Name ~= "Main" and v.Name ~= "ToolPopUp" then
v.Enabled = true
end
end
end
else
local pgUI = Player:WaitForChild("PlayerGui")
local GUI = pgUI:WaitForChild("Main")
local PN = script:WaitForChild("NoCoins"):Clone()
PN.Parent = GUI
wait(2)
PN:Destroy()
end
end
end
nvm is actually works!, thank you for help.