Hello, I am trying to make a hatching system for my game which you press E to open a case to get a hat. The problem is, is that I cant press the E button (Which is meant for mobile support) on the frame that pops up to show you the chances and the keybinds for you to open the case.
The other issue is got to do with the viewport side of the script. So I am trying to make it that when you get close to the case a billboard GUI enables which shows the chances of the hats you can open in that case, and the keybinds for you to open the case.
Pretty sure this is the script with the issue:
local range = 7.5 local deb = {} local caseInfoTable = caseEvents["GetCase"]:InvokeServer() for i, egg in pairs(game.Workspace.Eggs:GetChildren()) do if caseInfoTable[egg.Name] == nil then print("Case Not Found") elseif caseInfoTable[egg.Name] ~= nil then local eggInfo = caseInfoTable[egg.Name] local cost = eggInfo["Cost"][2] local currency = eggInfo["Cost"][1] local rarities = eggInfo["Rarities"] local chancesFrame = egg["BuyUI"]["Index"] for _, object in pairs(chancesFrame:GetChildren())do if object.Name ~= "UIGridLayout" then object:Destroy() end end egg["BuyUI"]["Cost"].Text = cost.." "..currency egg["BuyUI"]["E"].Activated:Connect(function() if deb["Case"] == nil then deb["Case"] = true caseEvents["Buy Case"]:InvokeServer(egg.Name) deb["Case"] = nil end end) egg["BuyUI"]["R"].Activated:Connect(function() if deb["Case"] == nil then deb["Case"] = true caseEvents["Triple Case"]:InvokeServer(egg.Name) deb["Case"] = nil end end) for i, v in pairs(rarities) do local temp = script.ToolTemplate:Clone() temp.Parent = chancesFrame temp.Visible = true local percentageText = temp["Extra"]["RarityChance"] if v[3] == "Legendary" then percentageText.Text = v[2].."%" coroutine.wrap(function() while percentageText ~= nil do wait(0.25) percentageText.TextColor3 = Color3.fromRGB(math.random(1, 255), math.random(1, 255), math.random(1, 255)) end end)() else percentageText.Text = v[2].."%" end percentageText.Visible = true temp.Name = v[1] temp.LayoutOrder = -v[2] coroutine.wrap(function() local viewportFrame = temp["ViewportFrame"] local part = RS["Hat Models"][v[1]]:Clone() part.Parent = viewportFrame local viewportCamera = Instance.new("Camera") viewportFrame.CurrentCamera = viewportCamera viewportCamera.Parent = viewportFrame part.CFrame = viewportCamera.CFrame + viewportCamera.CFrame.LookVector * 5 end)() end end end