Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i make this BillboardGUI disapear,or get smaller, at a certain distance?

I make a script that does damage and shows you the damage done with a BillboardGUI but when i get further away from the BillboardGUI it starts to get bigger and bigger. How do i make the Billboard disappear at a certain distance, or slowly get smaller? Here is the script

light.Touched:connect(function(hit)
	
	if not db then return end
db = false
	local opponent = hit.Parent:findFirstChild("Humanoid") or hit.Parent.Parent:findFirstChild("Humanoid")
if opponent and opponent ~= player.Character.Humanoid then
	local effect = Instance.new("BillboardGui", opponent.Parent.Head)
	effect.Size = UDim2.new(0,200,0,200)
wait()
local distance = 5
	local text = Instance.new("TextBox")
	text.Parent = effect
	text.Text = tool.Animation.Script.Damage.Value
	text.TextSize = 60
	text.TextColor3 = Color3.new(255,0,0)
	text.TextStrokeColor3 = Color3.new(170,0,0)
	text.Font = "Cartoon"
	text.BackgroundTransparency = 1
	text.Size = UDim2.new(0,200,0,50)
	distance = 20


	
		opponent:TakeDamage(tool.Animation.Script.Damage.Value)

wait(0.4)
db = true




end
end)

1 answer

If you use Scale instead of Offset to size both your BillboardGui and the Textbox, it will not get any bigger as you walk away.

UDim2 syntax: { xScale, xOffset }, { yScale, yOffset }

In your case, this would look something like:

--For the BillboardGui
effect.Size = UDim2.new(.2,0,.2,0)

--For the TextBox
text.Size = UDim2.new(.2,0,.05,0)

2 comments

0

thanks

0

No problem :) Remember to accept my answer if it helped you. Ensures both the Asker and the Answerer get reputation they deserve.

This discussion is preserved as it was. New answers, comments, and votes are closed.