Juice Bar Support Command Help

Hello! I am culsins, and I am making an upcoming juice bar called Kuavó. I am currently working on custom commands, and I had used a resource from the YouTube channel called ‘RoScripter.’ I did not know how to script this support command, so I used his tutorial. However I would like to make a change to it, but I am not sure how to do so.

  • Basically, when a Low Rank says ‘!support’ it sends a tiny box in the corner of your screen saying “username” is in need of assistance.

  • It comes with a teleport button.

Here’s the thing. Once you teleport to that player the GUI in the corner does not go away after you have teleported to them. The GUI in the corner only goes away after a certain time limit. I want to make it so when a Admin hits the teleport button, the GUI will go away for all of the other admins so they don’t have to all teleport to a support call when it is already being handled. Sorry if it seems confusing.

  • The other thing I want to implement is that the GUI will not go away until an admin has hit teleport on their call. It has a time limit, so if the admin is occupied, the support call will be there to answer when they are not busy so that they can go help the other player out.

Can anyone help me figure out how to add these things into my script?

Server Script

local GroupID = 12447069
local ModeratorRank = 7

-- / —————————— 🛠 —————————— \

game.Players.PlayerAdded:Connect(function(p)
	p.Chatted:Connect(function(m)
		if m == "!support" and p:GetRankInGroup(GroupID) >= 4 then
			for Index, EmployeeVictims in ipairs(game.Players:GetPlayers()) do
				if EmployeeVictims:GetRankInGroup(GroupID) >= ModeratorRank then
					game.ReplicatedStorage.AssistanceNotify:FireClient(EmployeeVictims, p)
				end
			end
		end
	end)
end)

Starter GUI script


local p = game.Players.LocalPlayer

-- / —————————— 🛠 —————————— \

game.ReplicatedStorage.AssistanceNotify.OnClientEvent:Connect(function(player)
	local TeleportPlayer = Instance.new("BindableFunction")
	TeleportPlayer.OnInvoke = function()
		p.Character:SetPrimaryPartCFrame(player.Character:GetPrimaryPartCFrame())
	end
	game.StarterGui:SetCore("SendNotification", {
		Title = "📩 Help Required",
		Text = p.Name .. " is requesting assistance.",
		Duration = 15,
		Button1 = "Teleport",
		Callback = TeleportPlayer
	})
end)

Help will be greatly appreciated. I am a new scripter, so I am not sure on how to do this yet hence I am less advanced. Thanks!

1 Like

Here is the problem. Just change it to the duration you want. Cause I don’t really know how to help you to make it go away when someone clicked it.

I would suggest not using YouTube tutorials as they are not really that efficient. However, I have re-coded the script for you. Let me know if you have any questions.

STEP 1:
Create a script in ServerScriptService, you can title this as “SupportHandler”.
Insert the following code in that script:

-- slidingseason

-- Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PlayerService = game:GetService("Players")

-- Variables
local SupportRemote = ReplicatedStorage:WaitForChild("AssistanceNotify")

local SettingsDictionary = {
	["Group Configuration"] = {
		["GroupId"] = 12447069, -- // Change this to the GroupId
		["Staff Rank"] = 4,-- // Change this to the staff rank that is allowed to use the support command
		["Moderator Rank"] = 7-- // Change this to the moderator Rank
	},
	["Command Configuration"] = {
		["Command"] = "!support", -- // Change this to the command you want to request support
		["Cooldown Time"] = 10, -- // (IN SECONDS) Players can't use the !support command for this many seconds
		["Cooldown Table"] = {} -- // Don't touch this
	},
	["Output Messages"] = {
		["Warning Message"] = "⚠️ [Script] [SupportHandler]: %s is not a Moderator in the group!",
		["Player Not Found Message"] = "⚠️ [Script] [SupportHandler]: %s is not in the server!",
		["Kick Message"] = "\nKuavó\n\nYou are not a Moderator in the group!\nDo not exploit our systems.\n"
	}
}

-- Create Bindable
local BindableRemote = Instance.new("BindableFunction", ReplicatedStorage)
BindableRemote.Name = "SupportBindable"

-- Code
PlayerService.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(Message)
		if Message:lower() == SettingsDictionary["Command Configuration"]["Command"] then
			if Player:GetRankInGroup(SettingsDictionary["Group Configuration"]["GroupId"]) >= SettingsDictionary["Group Configuration"]["Staff Rank"] then
				if not SettingsDictionary["Command Configuration"]["Cooldown Table"][Player] then
					SettingsDictionary["Command Configuration"]["Cooldown Table"][Player] = 0
				end
				
				if tick() - SettingsDictionary["Command Configuration"]["Cooldown Table"][Player] >= 10 then
					SettingsDictionary["Command Configuration"]["Cooldown Table"][Player] = tick()
					for Index, Moderators in pairs(PlayerService:GetPlayers()) do
						if Moderators:GetRankInGroup(SettingsDictionary["Group Configuration"]["GroupId"]) >= SettingsDictionary["Group Configuration"]["Moderator Rank"] then
							print(Player.Name)
							SupportRemote:FireClient(Moderators, {
								["Player"] = Player.Name
							})
						end
					end
				end
			else
				warn(SettingsDictionary["Output Messages"]["Warning Message"]:format(Player.Name))
			end
		end
	end)
end)

STEP 2:
Create a script in StarterPlayerScripts, you can title this as “SupportClient”
Insert the following code in that script:

-- slidingseason

-- Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PlayerService = game:GetService("Players")
local StarterGui = game:GetService("StarterGui")

-- Variables
local SupportRemote = ReplicatedStorage:WaitForChild("AssistanceNotify")
local SupportBindable = ReplicatedStorage:WaitForChild("SupportBindable")

local Player = PlayerService.LocalPlayer

local SettingsDictionary = {
	["Notification Messages"] = {
		["Prompt"] = "%s is requesting assistance!" -- // Notification moderators will receive when someone requests assistance
	}
}

-- Code
SupportRemote.OnClientEvent:Connect(function(RemoteData)
	SupportBindable.OnInvoke = function()
		local FoundPlayer = PlayerService:FindFirstChild(RemoteData["Player"])
		if FoundPlayer then
			local FinalTarget = workspace:FindFirstChild(FoundPlayer.Name)
			local FinalPlayer = workspace:FindFirstChild(Player.Name)
			if FinalTarget then
				Player.Character.Humanoid.Jump = true
				FinalPlayer.UpperTorso.CFrame = FinalTarget.UpperTorso.CFrame * CFrame.Angles(0, math.rad(90), 0) * CFrame.new(5.2, 0, 0) * CFrame.Angles(0, math.rad(90), 0)
			end
		end
	end
	
	StarterGui:SetCore("SendNotification", {
		Title = "📩 Help Required",
		Text = SettingsDictionary["Notification Messages"]["Prompt"]:format(RemoteData["Player"]),
		Button1 = "Teleport",
		Callback = SupportBindable
	})
end)

And you’re done! Let me know if you experience any errors.

1 Like

Thank you for your help, it works perfectly.

1 Like