GUi not opening, interact E & scripting

When I used debugging script it printed like attempting to create gui and etc. But no errors shown and it didnt create like clone or open gui or anything.

1 Like

Ok yeah then i have no idea at all… this is very weird

someone else might be able to see the issue but im blind or something lol

im sorry i could not help

I have to type for me to send this message

The point of the hibachi script is that it gets food from the FoodItems folder and it uses texture to create like a small pop out in the gui (frame) to choose which food to cook. But it wont open the gui or anything which should open main frame and do the rest.

local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local CookingGui = ReplicatedStorage:FindFirstChild(“CookingGui”)
local CookingMini = ReplicatedStorage:FindFirstChild(“CookingMinigame”)
local TweenService = game:GetService(“TweenService”)
local Players = game:GetService(“Players”)

local hibachi = script.Parent
local grill = hibachi.Grill
local proximity = grill.ProximityPrompt

local teleportPart = hibachi.TeleportPart
local FirePart = hibachi.FirePart.Fire
local FireGoal = hibachi.EndGoal

local originalFirePartCFrame = FirePart.Parent.CFrame

local connections = {}

– store the last player object who interacted
local playerLastInteraction = nil
local lastShelfProximity = nil

– TODO: on player leave remove their connection

local RemoveClient = ReplicatedStorage:WaitForChild(“RemoveClient”)

local function cleanupConnections()
warn(connections)
for key, connection in pairs(connections) do
if typeof(connection) == “RBXScriptConnection” and connection.Connected then
connection:Disconnect()
–warn(“is .Connected?”, connection.Connected)
elseif typeof(connection) == “Instance” then
connection:Destroy()
end
connections[key] = nil
end
playerLastInteraction = nil
warn(connections)
end

local function reset_grill(player: Player)
local playerCharacter = player.Character or player.CharacterAdded:Wait()

playerCharacter.PrimaryPart.Anchored = false
FirePart.Enabled = false
playerLastInteraction = nil
–cookProximity:Destroy() removed by connection servicing
–shelfProximity.Enabled = false may be a future bug
proximity.Enabled = true

if lastShelfProximity ~= nil then
lastShelfProximity.Enabled = false
end

FirePart.Parent.CFrame = originalFirePartCFrame

playerLastInteraction = nil
–connections[player]:Disconnect()
–connections[player] = nil

local cleanup = {“clonedGotoBeam”, “attachment0”, “attachment1”}

for index, value in pairs(cleanup) do
if connections[value] ~= nil then
connections[value]:Destroy()
connections[value] = nil
end
end

end

RemoveClient.OnServerEvent:Connect(function(player: Player)
warn(“pressed exit button”)
local PlayerGui = player:WaitForChild(“PlayerGui”)
for _, gui in pairs(PlayerGui:GetChildren()) do
if gui.Name == “CookingGui” or “CookingMinigame” then
gui:Destroy()
end
end
cleanupConnections()
reset_grill(player)
end)

Players.PlayerAdded:Connect(function(player: Player)
player.CharacterRemoving:Connect(function(character)
warn(“cleanup character conncections”)
cleanupConnections()
reset_grill(player)
end)
end)

Players.PlayerRemoving:Connect(function(player: Player)

warn(player.Name, “Left the game and triggered a cleanup”)
cleanupConnections()
reset_grill(player)
end)

local function findClosestShelf(Hibachi:Model, Shelves:Model): Model
local closestShelf = nil
local closestDistance = math.huge
for _, shelf in pairs(Shelves:GetChildren()) do
if shelf:IsA(“Model”) and shelf.PrimaryPart ~= nil and Hibachi.PrimaryPart ~= nil then
local distance = (Hibachi.PrimaryPart.Position - shelf.PrimaryPart.Position).Magnitude
if distance < closestDistance then
closestShelf = shelf
closestDistance = distance
end
end
warn(closestShelf, closestDistance)
end
return closestShelf
end

local function selectCallback(player:Player, dish:string, …)
warn(player, dish, …)

–proximity.Enabled = false Multiplayer fix
local playerCharacter = player.Character
local HumanoidRootPart = playerCharacter:FindFirstChild(“HumanoidRootPart”)

local Humanoid = playerCharacter:FindFirstChildOfClass(“Humanoid”)
local Animator:Animator = Humanoid:WaitForChild(“Animator”)

playerCharacter.PrimaryPart.Anchored = true
playerCharacter:PivotTo(teleportPart:GetPivot() * CFrame.new(0, 2.9, 0))

– play animation
local OilPourAnimation = ReplicatedStorage.Animations.OilPour
local animationTrack = Animator:LoadAnimation(OilPourAnimation)
animationTrack:Play(1, 1, 0.55)

– Start fire effect
task.wait(3)
FirePart.Parent.CFrame = originalFirePartCFrame
FirePart.Enabled = true
local FireMovement = TweenService:Create(FirePart.Parent, TweenInfo.new(2), {CFrame = FireGoal.CFrame})
FireMovement:Play()
task.wait(2)
playerCharacter.PrimaryPart.Anchored = false

– find a random shelf and create that beam effect
local shelvesObject = hibachi.ConnectedShelves.Value
local TargetShelf = findClosestShelf(hibachi, shelvesObject)
–local TargetShelf = shelvesObject.Shelf
–local TargetShelves = shelvesObject:GetChildren()
–local TargetShelf = TargetShelves[math.random(1, #TargetShelves)]

local clonedGotoBeam = ReplicatedStorage:WaitForChild(“GotoBeam”):Clone()
clonedGotoBeam.Parent = HumanoidRootPart

if HumanoidRootPart ~= nil and TargetShelf.PrimaryPart ~= nil then
warn(“attaching beam object”)

  local attachment0 = Instance.new("Attachment", playerCharacter.PrimaryPart)
  attachment0.Name = "Attachment0"
  
  local clonedGotoBeam = ReplicatedStorage:WaitForChild("GotoBeam"):Clone()
  clonedGotoBeam.Parent = playerCharacter.PrimaryPart
  clonedGotoBeam.Enabled = true
  
  local attachment1 = Instance.new("Attachment", TargetShelf.PrimaryPart)
  attachment1.Name = "Attachment1"

  clonedGotoBeam.Attachment0 = attachment1
  clonedGotoBeam.Attachment1 = attachment0
  
  connections["clonedGotoBeam"] = clonedGotoBeam;
  connections["attachment0"] = attachment0;
  connections["attachment1"] = attachment1;
  
  -- skipping that
  local shelfProximity:ProximityPrompt = TargetShelf.PrimaryPart:WaitForChild("ProximityPrompt")
  shelfProximity.Enabled = true
  lastShelfProximity = shelfProximity
  --warn(shelfProximity:GetFullName())
  
  local chosenGear = ReplicatedStorage.FoodItems[dish]:Clone()
  
  -- add this to the connection list instead
  
  connections["shelfProximity"] = shelfProximity.Triggered:Connect(function(player)
  	if playerLastInteraction == player then
  		chosenGear.Parent = player.Backpack
  		shelfProximity.Enabled = false
  		connections["shelfProximity"]:Disconnect()
  		
  		-- remove stuff
  		connections["clonedGotoBeam"]:Destroy()
  		connections["attachment0"]:Destroy()
  		connections["attachment1"]:Destroy()
  	end
  end)
  
  -- create a new proximity prompt on the grill called "cook"

  proximity.Enabled = false -- disable the old proximity prompt
  local cookConnection = nil
  local cookProximity = Instance.new("ProximityPrompt", grill)
  cookProximity.ActionText = "Cook "..dish
  cookProximity.ObjectText = "Grill"
  
  table.insert(connections, cookProximity)
  
  cookConnection = cookProximity.Triggered:Connect(function(player)
  	-- we need to know if they have the tool out
  	-- otherwise throw an error message
  	local playerCharacter = player.Character
  	
  	if playerLastInteraction == player then
  		
  		local foundGear = playerCharacter:FindFirstChild(chosenGear.Name)
  		if foundGear ~= nil and foundGear == chosenGear then
  			-- player has the tool out, lets now cook 
  			warn("cooking food now")
  			
  			playerCharacter.PrimaryPart.Anchored = true
  			playerCharacter:PivotTo(teleportPart:GetPivot() * CFrame.new(0, 2.9, 0))
  			
  			-- now to clone that minigame and bind to get the result
  			
  			
  			local clonedMinigame = ReplicatedStorage.CookingMinigame:Clone()
  			local foundRemote = clonedMinigame:FindFirstChild("CompletedMinigame")
  			local PlayerGui = player:FindFirstChild("PlayerGui")
  			local foundGui = PlayerGui:FindFirstChild(clonedMinigame.Name)
  			if foundGui == nil then
  				clonedMinigame.Parent = PlayerGui
  			else
  				foundGui.Enabled = true
  			end
  			
  			
  			local remoteConnection = nil
  			remoteConnection = foundRemote.OnServerEvent:Once(function()
  				-- they at this point have destroyed the gui
  				-- now we are supposed to give them a new item
  				warn("won the game lol")
  				for _, gui in pairs(PlayerGui:GetChildren()) do
  					if gui.Name == "CookingGui" or "CookingMinigame" then
  						gui:Destroy()
  					end
  				end
  				
  				playerCharacter.PrimaryPart.Anchored = false
  				FirePart.Enabled = false
  				playerLastInteraction = nil
  				cookProximity:Destroy()
  				shelfProximity.Enabled = false
  				proximity.Enabled = true
  				
  				FirePart.Parent.CFrame = originalFirePartCFrame 
  				
  				playerLastInteraction = nil
  				connections[player]:Disconnect()
  				connections[player] = nil
  				
  				remoteConnection:Disconnect()
  				remoteConnection = nil
  				
  				
  			end)
  			
  			
  			
  			
  		end
  	end
  	
  	
  	
  end)

else
warn(“conditions not satisfied”)
end

–cleanupConnections()
end

local function GetFoodItems(): {}
local FoodItems = ReplicatedStorage.FoodItems
local result = {}

for _, item in pairs(FoodItems:GetChildren()) do
if item:IsA(“Tool”) and item:FindFirstChildOfClass(“StringValue”) then
local TextureId = item.Texture
result[item.Name] = TextureId.Value
end
end

return result
end

proximity.Triggered:Connect(function(player: Player)
warn(player.Name)
warn(connections)
– no one has used this before or has left
if not playerLastInteraction and player:IsInGroup(35411958) and player:GetRankInGroup(35411958) >= 3 then
warn(“is in group”)
local playerGui = player:FindFirstChild(“PlayerGui”)

  playerLastInteraction = player
  -- give the gui to the player
  
  -- remove any previous guis we dont want
  for _, item in pairs(playerGui:GetChildren()) do
  	if item.Name == CookingGui.Name or item.Name == CookingMini.Name then
  		item:Destroy()
  	end
  end
  
  if connections[player] == nil then

  	local clonedGui = CookingGui:Clone()
  	clonedGui.Parent = playerGui
  	clonedGui.Enabled = true
  	
  	local updateEvent = clonedGui:FindFirstChild("GetDishes")
  	local updateFoodConnection = nil
  	updateFoodConnection = updateEvent.OnServerEvent:Once(function(player)
  		warn("firing back to client response")
  		local foodItems = GetFoodItems()
  		updateEvent:FireClient(player, foodItems)
  		warn(foodItems)
  		
  		updateFoodConnection:Disconnect()
  		updateFoodConnection = nil
  	end)
  	
  	-- find our trigger and bind onserverevent
  	local selectEvent = clonedGui:FindFirstChild("SelectDish")
  	connections[player] = selectEvent.OnServerEvent:Once(selectCallback)
  end

else
– player walked away, task.delay this sep thread for timeout

end

end)

local ScreenGui = script.Parent
local Mainframe = ScreenGui.MainFrame
local ExitButton = Mainframe.Exit
local ItemList = Mainframe.ItemList

local connections = {}

local SelectDish = ScreenGui:WaitForChild(“SelectDish”)
local GetDishes = ScreenGui:WaitForChild(“GetDishes”)
local DestroyClient = game.ReplicatedStorage:WaitForChild(“RemoveClient”)

– send request to server to give us available food items and their textures
– loop through every given

local function cleanupConnections()
–warn(connections)
for key, connection in pairs(connections) do
if typeof(connection) == “RBXScriptConnection” and connection.Connected then
connection:Disconnect()
–warn(“is .Connected?”, connection.Connected)
connections[key] = nil
end
end
–warn(connections)
end

local function foodSelectCallback(foodName: string)
SelectDish:FireServer(foodName)
cleanupConnections()
warn(connections)
ScreenGui:Destroy()
end

local function clientEventCallback(itemlist:{})
– returned type is keyed dictionary
warn(“recived from server”, itemlist)
for key, value in pairs(itemlist) do

  local FoodItem = Mainframe.FoodItem:Clone()
  FoodItem.Parent = ItemList
  FoodItem.FoodName.Text = key
  FoodItem.FoodImage.Image = value
  FoodItem.Visible = true
  
  -- setup connections
  connections[FoodItem.FoodName.Text] = FoodItem.Select.MouseButton1Click:Connect(function()
  	foodSelectCallback(key)
  end)

end

end

warn(“firing server”)
GetDishes:FireServer()

–ItemList.FoodItem1.Select.MouseButton1Click:Connect(function()
– SelectDish:FireServer(“misoSoup”)
– ScreenGui:Destroy()
–end)

–ItemList.FoodItem1.Select.MouseEnter:Connect(function()
– ItemList.FoodItem1.Select.Roundify.ImageColor3 = Color3.fromRGB(135, 28, 28)
–end)

–ItemList.FoodItem1.Select.MouseLeave:Connect(function()
– ItemList.FoodItem1.Select.Roundify.ImageColor3 = Color3.fromRGB(212, 44, 44)
–end)

ExitButton.MouseButton1Click:Connect(function()
DestroyClient:FireServer()

local player = game.Players.LocalPlayer
local playerGui = player.PlayerGui

ScreenGui:Destroy()
end)

GetDishes.OnClientEvent:Connect(clientEventCallback)

this would be the script of the CookingGui

Hey, I would love to help. :slightly_smiling_face:

This isn’t entirely correct, .Triggered in the ProximityPrompt does work on the client,:
Medal_dlkKhTBbfC

However, you can’t have a local script in them. This is because:

Local scripts can’t run in workspace they have to be in either StarterCharacterScripts, StarterPlayerScripts, ReplicatedFirst

For more information on that you can check this out: How To Check if a proximity prompt have been triggered in a local script? - Help and Feedback / Scripting Support - Developer Forum | Roblox

Does the issue happen every time or does it work the first time and then break after that? What are the errors in the console? Make sure PlayerGui exists first too before referencing it! The GUI might be inside StarterGui but not appearing on the player’s screen.

If the GUI does exist, it should be enabled from a LocalScript, not a ServerScript. It is hard to help debug this issue without knowing your exact setup! Let me know if you need more help and if you could provide more information that would be really helpful too.

1 Like

Just seen you have provided much more information! Please give me some time to go over it all :smile:

In the v3 version it worked normally. But since I already copied guis and setted everything I only copyied grills. But grills are connected to the GUi as usually normal. And when I did everything its not working. So it doesn’t work in the new game. Not at all it just doesn’t open gui or anything. The gui is enabled and it is in replicated storage. and it is active.

image

This condition is incorrect because "CookingMinigame" is always truthy.

if gui.Name == "CookingGui" or gui.Name == "CookingMinigame" then

CookingMiniGame is seperated and used for the mini-game cooking when is food received from shelves and then like cooking onto the grill.

image
this is cooking gui the inside, not sure if necessarry or needed but here it is.

I think you misunderstood what I meant. In Lua (and most programming languages), a truthy value is any value that evaluates to true in a conditional statement.

When I say “always truthy”, I mean that a condition will always evaluate as true, even when it wasn’t intended to.

We can test this by printing in our console:

if workspace:FindFirstChild("CookingMinigame") or "CookingMinigame" then print(true) else print(false) end

Since "CookingMinigame" is a string and, in Lua, all non-nil values are truthy. This means the condition always evaluates to true.

Value Truthy or Falsy?
true :white_check_mark: Truthy
"Hello" :white_check_mark: Truthy
0 :white_check_mark: Truthy
{} (table) :white_check_mark: Truthy
function() end :white_check_mark: Truthy
false :x: Falsy
nil :x: Falsy

@Awo_kein do you want me to show you how grill actually first works? Maybe its confusing ig…

So where do I need to put the part

if workspace:FindFirstChild(“CookingMinigame”) or “CookingMinigame” then print(true) else print(false) end

replacing every “playerGui” to "player:FindFirstChild(“PlayerGui”)

This was simply an example. What exactly is "CookingMiniGame"? If you are trying to find out if the gui name is “CookingMinigame” then this expression should work fine:

if gui.Name == "CookingGui" or gui.Name == "CookingMinigame" then

CookingMiniGame is when the food is received from shelves and then it comes up as mini game to not get players bored. To like do a mini game and then cooking finishes.

:link: Arezi Kitchen - Official - Grill! - Album on Imgur

make sure:

  1. the group id is correct
  2. the “CookingGui” is set correctly: suggestion:
local clonedGui = CookingGui:Clone()
clonedGui.Parent = playerGui
clonedGui.Enabled = true

in the script below, make sure “GetDishes” event exists in the GUI:

local updateEvent = clonedGui:FindFirstChild("GetDishes")
if updateEvent then
    local updateFoodConnection

    updateFoodConnection = updateEvent.OnServerEvent:Once(function(player)
        warn("Firing back to client response")

Check Output Window: Look for any warnings or errors in the output window while running your game. This can provide insights into what might be going wrong.
2. Verify References: Double-check that all references (proximity, CookingGui, CookingMini) are correct and exist in your game’s hierarchy.
3. Test Group Membership: Temporarily add print statements to confirm whether the player meets the group and rank conditions.
4. Enable GUI Visibility: Ensure that there are no other scripts or settings that might be disabling the visibility of your GUI after it’s created.
5. Check for Errors: If there are any errors in your script (like syntax errors), they could prevent execution. Ensure all comments use proper syntax (e.g., use -- for single-line comments).

Hello, I was setting up my new lenovo monitor. Allow me a moment to review everything you’ve sent me!