Changing a Players Billboard GUI

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.

First, never trust the client.
So you should handle these in a server script inside the tool.

Make a variable like this at the place where you define variables:

local Character

This is to call the player’s Character on other functions

Then, Add a equipped function.

script.Parent.Equipped:Connect(function() 
Character = Script.Parent.Parent
end)

Then an activated function

script.Parent.Activated:Connect(function()
local Text = Character.Head.PlayerTag.KillTag.Text
--your stuff here
end)

This method doesn’t use remote events so it’s not exploitable.

And please don’t copy my script as I’m typing it on a mobile so errors might happen due to mobile autocorrect.

1 Like