Changing a Players Billboard GUI

Hello,

  1. What do you want to achieve? When a player clicks with a tool it changes their billboard GUI text.

  2. What is the issue? No errors and nothing happens.

  3. What solutions have you tried so far? I have looked on the forums and tried messing around but nothing has worked.

  • Script inside of the tool. [LocalScript]
local tool = script.Parent
local event = game.ReplicatedStorage.KillzoneChanged

function toolused(plr)
	
	if plr:GetRankInGroup(6170760) >= 50 then
		event:FireServer(plr)
	else
		script.Parent:Destroy()
	end
	
end

tool.Activated:Connect(toolused)
  • Script in ServerScriptService [Script]
local event = game.ReplicatedStorage.KillzoneChanged

function changetext(plr)
	
	print("KillZone Change Recived")
	local text = plr.Character.Head.PlayerTag.KillTag.Text
	
	if text == "Killzone: Off" then
		text = "Killzone: On"
	elseif text == "Killzone: On" then
		text = "Killzone: Off"
	end
	
end

event.OnServerEvent:Connect(changetext)
2 Likes

Is the TextBox initially set to either Killzone: Off or Killzone: On? If not, it will never be true for either if statement.

1 Like

It is set to a bunch of random letters.

1 Like

Set the text to “Killzone: Off” and run it again.

You can put all of this inside of the server script for convenience and security.

What would that look like?

(not enough)

function changetext(plr)
	if plr:GetRankInGroup(6170760) >= 50 then
	print("KillZone Change Recived")
	local text = plr.Character.Head.PlayerTag.KillTag.Text
	
	if text == "Killzone: Off" then
		text = "Killzone: On"
	elseif text == "Killzone: On" then
		text = "Killzone: Off"
	end
else
script.Parent:Destroy()
	end
end

tool.Activated:Connect(changetext)

something like this.
Should work when you change the initial text in the textbox to “Killzone: Off”

1 Like

How would I call the player and the tool?

1 Like

Should be exactly the same as you were doing in the LocalScript.

1 Like

You cant call the local player in a server script…

I was talking about the tool.Activated passing the player.

And there’s other solutions if you need it outside of the function which gets the player.

Please don’t respond if you don’t know the answer.

I haven’t worked with tools in a while so I assumed you were doing it correctly yourself.

The tool can only be activated if it’s equipped do you can just get the player by doing

local player = game.Players:GetPlayerFromCharacter(script.Parent.Parent)

or that other solution I qouted.
If you learn to read the script you can obviously tell it won’t do anything unless the text that is already in the TextBox is either “Killzone: Off” or “Killzone: On”.

	if text == "Killzone: Off" then
		text = "Killzone: On"
	elseif text == "Killzone: On" then
		text = "Killzone: Off"
	end

Specify your variables correctly, please.
That is a bad practice, this is what it should look like:

task.wait()
local character = plr.Character or plr.CharacterAdded:Wait()
local head = character:WaitForChild("Head")
local Tag = head:FindFirstChild("PlayerTag")
local KillTag = tag:FindFirstChild("KillTag")
local text = tostring(KillTag.ContentText)

Also, you can’t call a player using the tool.Activated event.
I suggest you do this in your LocalScript.

local tool = script.Parent
local event = game.ReplicatedStorage.KillzoneChanged

function toolused()
	local plr = game.Players.LocalPlayer
	
	if plr:GetRankInGroup(6170760) >= 50 then
		event:FireServer(plr)
	else
		script.Parent:Destroy()
	end
	
end

tool.Activated:Connect(toolused)
1 Like

Perfectly fine if you expect no one to exploit in the game

Not my problem, though.
The poster wants the answer, let the poster handle the ‘exploiter situation’.

True though it was just a comment on the method OP was using.

Responding like this is a sure-fire way for absolutely no-one to help you.