Hey,
I’m trying to make a egg collecting system like Egg Hunt 2022, except my egg doesn’t rotate and it’s pretty annoying. I can’t seem to get it fixed.
Pick up code:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvents = ReplicatedStorage.RemoteEvents
local Debounce = false
local Model = script.Parent
script.Parent.Touched:Connect(function(Object)
if Object.Parent:FindFirstChild("Humanoid") and Debounce == false then
Debounce = true
local Player = Players:GetPlayerFromCharacter(Object.Parent)
if not Player.Eggs.LavaEgg.Value then
RemoteEvents.Handler:FireClient(Player, "NewEgg", Model)
Player.Eggs.LavaEgg.Value = true
elseif Player.Eggs.LavaEgg.Value then
RemoteEvents.Handler:FireClient(Player, "AlreadyEgg", Model)
end
--task.wait(0.001)
--Debounce = false
end
end)
Client code:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local RemoteEvents = ReplicatedStorage.RemoteEvents
local EggFrame = script.Parent.EggFrame
local ViewportFrame = EggFrame.ViewportFrame
local EggLabel = EggFrame.EggLabel
local TweenInformation = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut)
local Tween
local outcodeEgg
--[[local function SetEgg(Egg)
local ClonedEgg = ReplicatedStorage.Eggs[Egg.Name]:Clone()
ViewportFrame:ClearAllChildren()
ClonedEgg.Parent = ViewportFrame
EggLabel.Text = Egg.Name.." Egg"
outcodeEgg = Egg
local Camera = Instance.new("Camera")
Camera.Parent = ViewportFrame
ViewportFrame.CurrentCamera = Camera
Camera.CFrame = Egg.CFrame * CFrame.new(0, 0, Egg.Size.z * 1.5)
Tween = TweenService:Create(Egg, TweenInformation, {Orientation = Vector3.new(0, 360, 0)})
end--]]
RemoteEvents.Handler.OnClientEvent:Connect(function(Argument, Egg)
if not Argument then return end
if Argument == "NewEgg" then
Egg:Destroy()
--SetEgg(Egg)
EggFrame.Visible = true
local ClonedEgg = ReplicatedStorage.Eggs[Egg.Name]:Clone()
ViewportFrame:ClearAllChildren()
ClonedEgg.Parent = ViewportFrame
EggLabel.Text = Egg.Name.." Egg"
outcodeEgg = Egg
local Camera = Instance.new("Camera")
Camera.Parent = ViewportFrame
ViewportFrame.CurrentCamera = Camera
Camera.CFrame = Egg.CFrame * CFrame.new(0, 0, Egg.Size.z * 1.5)
Tween = TweenService:Create(Egg, TweenInformation, {Orientation = Vector3.new(0, 360, 0)})
elseif Argument == "AlreadyEgg" then
Egg:Destroy()
end
end)
while true do
if outcodeEgg then
Tween:Play()
Tween.Completed:Wait()
end
task.wait()
end