(The script mentioned has to be a LocalScript not a regular script.)
To do something like this you have to first start with the head tag using a billboard gui, Then putting it inside a script then making a GUI inside of StarterGUI and then inside the ScreenGui you create make a button and put a local script under inside the main Billboard GUI and inside the script write (The script has to be in ServerScriptService) :
local ServerScriptService = game.ServerScriptService
script.BillboardGUI.TextLabel.MouseButton1Click:Connect(function()
ServerScriptService.ScriptsName.Disabled = true -- Change "ScriptsName" to what the script's name is.
end)
So what about the group like would I put the first like the script leads group id than add that script? Which would be the one that would disable when someone pressed D or some thing around that.
You can do this using UserInputService and remote events. With a local script inside StarterPlayerScripts that detects when a player presses a key on their keyboard and fires an event to the server to turn off their tag.
–Example Code for client input
local UIS = game:GetService("UserInputService")
local remoteEvent = game:GetService("ReplicatedStorage").RemoteEvent
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.A then -- Change "A" to the key you want the player to press
remoteEvent:FireServer()
end
end)
–Script in ServerScriptService to detect when a player wants to turn off their tag
local remoteEvent = game:GetService("ReplicatedStorage").RemoteEvent
remoteEvent.OnServerEvent:Connect(function(player)
print(player, "sent a request to turn off their tag!")
--Code here to change the tag goes here
end)
If you only want the tag to be turned off for the player turning it off you can skip the remote event and edit the code in the script detecting when the player presses a key.
Example:
local UIS = game:GetService("UserInputService")
local remoteEvent = game:GetService("ReplicatedStorage").RemoteEvent
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.A then -- Change "A" to the key you want the player to press
print("Player turned off their tag locally")
--Code to change the tag goes here
end
end)
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(InputBegan, GameProcess))
if InputBegan.KeyCode == Enum.KeyCode.E then
--fire a remote to disable/enable on server
end
end)
Make a ScreenGui with a button and inside the button make a localscript then use the .Disable = true on the head tag script.
local ServerScriptService=game.ServerScriptService
script.Parent.MouseButton1Click(function()
ServerScriptService.ScriptsName.Disabled = true --Change the "ScriptsName" to the head tag's script and make sure it's in the ServerScriptService.
end)
So would it some thing like---- local groupId = 3309343
player:GetRoleInGroup(groupId)
local UserInputService = game:GetService(“UserInputService”)
UserInputService.InputBegan:Connect(function(InputBegan, GameProcess))
if InputBegan.KeyCode == Enum.KeyCode.E then
–fire a remote to disable/enable on server
end
end)