The gui only opens once, after it’s closed it won’t open again. I’m guessing it’s related to the proximity prompt, but I have no idea. I even made a remote event just to enable the screen gui. Any ideas?
local PS = game:GetService("ProximityPromptService")
-- employee = {name, skill,age,salary, gender, level,{"working on this", "working on that"}}
local AssignEmployee = game.ReplicatedStorage.Remotes.RemoteEvents.AssignEmployee
local EnableEmpGui = game.ReplicatedStorage.Remotes.RemoteEvents.OpenEmployeeGui
AssignEmployee.OnServerEvent:Connect(function(player, deskName, employeeName)
game.Workspace["Office_" .. player.UserId].Desks[deskName].Person.Value = employeeName
end)
PS.PromptTriggered:Connect(function(prompt, player)
local name = prompt.Name
local EmployeeGUI = game.Players[player.Name].PlayerGui:WaitForChild("Employee")
if name == "Desk" then
local office = prompt.Parent.Parent.Parent
if office.Owner.Value == player.UserId then --Check if the player is the owner
--Check if there's an employee sitting
if prompt.Parent.Person.Value == "" then -- If there isn't
--Show employee selection screen
warn("?")
EnableEmpGui:FireClient(player)
EmployeeGUI.Assigned.Visible = false
EmployeeGUI.NotAssigned.Visible = true
EmployeeGUI.NotAssigned.Desk.Value = prompt.Parent.Name
else --If there is
--Show employee info
warn("someone there")
local employee = game.ReplicatedStorage.Remotes.BindableFunctions.RequestData:Invoke(player, "Employee", prompt.Parent.Person.Value)
print(employee)
print("the employee assigned to this desk is " .. employee[1])
local frame = EmployeeGUI.Assigned
local main = frame.Main
main.Username.Text = employee[1]
main.Skill.Text = employee[2]
main.Age.Text = employee[3]
main.Salary.Text = employee[4]
frame.Visible = true
EmployeeGUI.NotAssigned.Visible = false
EnableEmpGui:FireClient(player)
EmployeeGUI.Assigned.Visible = true
end
end
end
end)