TweenService doesn't Working?

You put the :Play() function on the variable

Try doing this one

local TweenInfos = TweenInfo.new(2,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out,0,false,0)
local TweenService = game:GetService("TweenService")
local EggHatchFrame = game.StarterGui.ScreenGui.EggHatchFrame

PetHatched.OnClientEvent:Connect(function(pet: table)
	print("We received a"..pet.Name)
	local megistus =  TweenService:Create(EggHatchFrame,TweenInfos,{Position = UDim2.fromScale(0.391, 0,0.5, 0);})
megistus:Play()
	print("Welp")
end)

well. we tried this and after 2 hours of conversation. we deciced there isn’t any wrong with script anymore but still not working

Have you tried setting your size offset of your viewport frame to 0?
Like this:
{0.5,0}{0.5,0}

local ReplicatedStorage= game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local TweenInfos = TweenInfo.new(2,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out,0,false,0)

local Megistus = TweenService:Create(script.Parent,TweenInfos,{Position = UDim2.fromScale(0.391, 0.5)})

local EggClone = workspace:WaitForChild("Egg"):Clone()
EggClone.Parent= script.Parent

local EggHatchCamera = Instance.new("Camera",script.Parent)
script.Parent.CurrentCamera = EggHatchCamera
EggHatchCamera.CFrame= CFrame.new(EggClone.Position+Vector3.new(0,0,3),EggClone.Position)

Megistus:Play()

Try this, i think Remote Event dont needed. It was working with same things in the place.

I’v just trired what you said but

EGG MOVED but I am trying to move it after player press “e” button this is why I used remote event

Use UserInputService. Idk how to make like a prompt thing though

PS I’m on mobile right now


This “E” button not "key " one

You dont need to add anything. Give me a sec i will ready the script

First script:

local Workspace= game:GetService("Workspace")
local ReplicatedStorage= game:GetService("ReplicatedStorage")
local Players= game:GetService("Players")
local BuyEgg= ReplicatedStorage.Remotes.Shop.BuyEgg
local PetHatched= ReplicatedStorage.Remotes.Shop.PetHatched
local Player = Players.LocalPlayer

local TweenInfos = TweenInfo.new(2,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out,0,false,0)
local TweenService = game:GetService("TweenService")
local EggHatchFrame = game.StarterGui.ScreenGui.EggHatchFrame

local EggsFolder = Workspace.Eggs
local PetModels = ReplicatedStorage.Pets
local part = Workspace.Part
local EggConfig = require(ReplicatedStorage.Config.Eggs)

local template= script.Parent.Template

local function GetRarityColor(rarity: string)
	print(rarity)	
	local color
	if rarity == "Common" then
		color= Color3.fromRGB(136, 136, 136)
	elseif rarity == "Uncommon" then
		color= Color3.fromRGB(83, 255, 97)
	elseif rarity == "Rare" then
		color= Color3.fromRGB(55, 98, 199)
	elseif rarity == "Legendary" then
		color= Color3.fromRGB(225, 244, 50)
	end
	return color
end
local function GetChanceColor(chance: number)
	print(chance)
	if chance <101 then
		chance  = Color3.fromRGB(255,255,255)
	end
	return chance
end
local function GenerateViewportFrame(viewportFrame:ViewportFrame, petModel:Model)
	petModel:PivotTo(CFrame.new()*CFrame.Angles(0,math.rad(90),0))
	petModel.Parent=viewportFrame
	local camera = Instance.new("Camera",viewportFrame)
	viewportFrame.CurrentCamera= camera
	camera.CFrame = CFrame.new(Vector3.new(0,0,3),petModel.PrimaryPart.Position)

end
local function GeneratePet(container: Frame, petConfig: table)
	print(petConfig)
	local clone = container.template:Clone()
	clone.Parent = container
	clone.Name = petConfig.Name
	clone.Visible = true
	clone.ViewportFrame.PetName.Text =petConfig.Chance.."%"
	clone.ViewportFrame.PetName.TextColor3 = GetChanceColor(petConfig.Chance)
	clone.ViewportFrame.Rarity.Text = petConfig.Rarity
	clone.ViewportFrame.Rarity.TextColor3 = GetRarityColor(petConfig.Rarity)

	local petClone = PetModels[petConfig.Name]:Clone()
	GenerateViewportFrame(clone.ViewportFrame,petClone)
end



local function GenerateBillBoardGui(eggModel:Instance,eggConfig: table)
	print(eggConfig)
	local Attachment = eggModel.Egg.Attachment
	local Clone = template:Clone()
	Clone.Parent = script.Parent
	Clone.Adornee = Attachment
	Clone.Name= eggModel.Name
	for _,pet in ipairs(eggConfig.Pets) do
		GeneratePet(Clone.Frame.Container, pet)	
	end
	Clone.Frame.Buttons.Auto.MouseButton1Click:Connect(function()
		--if not Players.gamepass.AutoHatch.Value then
		-- Prompt them to the Purchase the Gamepass
		--else
		BuyEgg:FireServer(eggModel.Name,"Auto")
		--	end
	end)
	Clone.Frame.Buttons.X1.MouseButton1Click:Connect(function()
		BuyEgg:FireServer(eggModel.Name,"X1")
	end)
	Clone.Frame.Buttons.X3.MouseButton1Click:Connect(function()
		--		if not Players.gamepass.X3GamePass.Value then
		-- Prompt them to the Purchase the Gamepass
		--		else
		BuyEgg:FireServer(eggModel.Name,"X3")
		--		end
	end)
end

GenerateBillBoardGui(EggsFolder.Basic_Egg, EggConfig.Basic_Egg)

Second script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local BuyEgg = ReplicatedStorage.Remotes.Shop.BuyEgg
local ReplicatedStorage= game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local TweenInfos = TweenInfo.new(2,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out,0,false,0)

local Megistus = TweenService:Create(script.Parent,TweenInfos,{Position = UDim2.fromScale(0.391, 0.5)})

local EggClone = workspace:WaitForChild("Egg"):Clone()
EggClone.Parent= script.Parent

local EggHatchCamera = Instance.new("Camera",script.Parent)
script.Parent.CurrentCamera = EggHatchCamera
EggHatchCamera.CFrame= CFrame.new(EggClone.Position+Vector3.new(0,0,3),EggClone.Position)

BuyEgg.OnClientEvent:Connect(function()
	Megistus:Play()
end)

I feel sorry to say this but… no it is not working

There was some extra scripts i trying to fix it

I can fix it but it won’t work as you want. When you press to button, it does’nt selecting the pet also some scripts are doesn’t work. You must fix them first then you can add gui to the system. You need to connect the gui to the main script(Main script in the serverscriptservice). Basically you need to fix the main script and then connect the gui to main script. If you get any errors then send the script here.

let me see the script, if it will so much time to fix it or effort I will try to find other sources

local ReplicatedStorage =game:GetService("ReplicatedStorage")
local Workspace = game:GetService("Workspace")

local EggsFolder = Workspace.Eggs

local EggsConfig = require(ReplicatedStorage.Config.Eggs)

local BuyEgg = ReplicatedStorage.Remotes.Shop.BuyEgg
local PetHatched= ReplicatedStorage.Remotes.Shop.PetHatched

local HATCH_COOLDOWN = 3

local HatchCooldwon = {}
local function ChoosePet(pets: table)
	local totalWeight = 0
	for _, pet in ipairs(pets) do
		totalWeight += pet.Chance
	end
	
	local chance = math.random(1, totalWeight)
	local counter = 0
	for _, pet in ipairs(pets) do
		counter += pet.Chance
		if chance <= counter then
			return pet
		end
	end
end
local function Hatch(player: Player, eggId:string)
	if HatchCooldwon[player.UserId] then return end
	
	local eggConfig = EggsConfig[eggId]
	local playerBalance = player.leaderstats.Money.Value
	
	if playerBalance < eggConfig.Price then return end
	HatchCooldwon[player.UserId] = true

	player.leaderstats.Money.Value -= eggConfig.Price
	local pet = ChoosePet(eggConfig.Pets)
	PetHatched:FireClient(player, pet)
	print("You got a "..pet.Name)
	
	task.delay(HATCH_COOLDOWN, function()
		HatchCooldwon[player.UserId] = nil
	end)
end
local function CanHatch(player:Player, eggId: string)
	local eggConfig = EggsConfig[eggId]
	if not eggConfig then return false end
		
	local playerBalance = player.leaderstats.Money.Value
	return playerBalance >= eggConfig.Price 
end
BuyEgg.OnServerEvent:Connect(function(player: Player, eggId: string, action: string)
	if not CanHatch(player, eggId) then return end
		
	if action == "Auto" then
		--
	elseif action == "X3" then
		--
	else
        Hatch(player, eggId)
	end
end)

this is the script i experience problem and open a new thread for this script. People will help. This thread is off-topic no longer so.

1 Like

allright thanks you have my respect

1 Like