So I wrote this script a few days ago, and it works, apart from that it doesn’t actually delete the gui from the player’s head? Also how is everyone this fine evening
wait()
game.Workspace.OverheadGUIs.RemoteEvent.OnServerEvent:connect(function(player, cmd)
local ServerStorage = game:GetService("ServerStorage")
local DispatchRoleGUI = ServerStorage.OverheadRolesGUI.DispatchRole
local GuardRoleGUI = ServerStorage.OverheadRolesGUI.GuardRole
local DriverRoleGUI = ServerStorage.OverheadRolesGUI.DriverRole
local character = player.Character
local DispatchRole = false
local DriverRole = false
local GuardRole = false
local NoRole = true
if cmd == "DispatcherRole" then
if DriverRole == true then
character.Head:FindFirstChild("DriverRole"):Destroy()
DriverRole = false
elseif GuardRole == true then
character.Head:FindFirstChild("GuardRole"):Destroy()
GuardRole = false
else
DispatchRole = true
GuardRole = false
DriverRole = false
NoRole = false
local clonedgui = DispatchRoleGUI:Clone()
clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
end
end
if cmd == "GuardRole" then
if DriverRole == true then
character.Head:FindFirstChild("DriverRole"):Destroy()
DriverRole = false
elseif DispatchRole == true then
character.Head:FindFirstChild("DispatchRole"):Destroy()
DispatchRole = false
else
GuardRole = true
DispatchRole = false
DriverRole = false
NoRole = false
local clonedgui = GuardRoleGUI:Clone()
clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
end
end
if cmd == "DriverRole" then
if DispatchRole == true then
character.Head:FindFirstChild("DispatchRole"):Destroy()
DispatchRole = false
elseif GuardRole == true then
character.Head:FindFirstChild("GuardRole"):Destroy()
GuardRole = false
else
DriverRole = true
GuardRole = false
DispatchRole = false
NoRole = false
local clonedgui = DriverRoleGUI:Clone()
clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
end
end
if cmd == "DeleteRole" then
if DriverRole == true then
character.Head:FindFirstChild("DriverRole"):Destroy()
DriverRole = false
elseif GuardRole == true then
character.Head:FindFirstChild("GuardRole"):Destroy()
GuardRole = false
elseif DispatchRole == true then
character.Head:FindFirstChild("DispatchRole"):Destroy()
DispatchRole = false
end
NoRole = true
end
end)