Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Make text label in BillbroadGui shifting position up and down by a few pixels?

Asked by 4 years ago
Edited 4 years ago

I want make a text label in BillbroadGui can move up and down slowly in a small distance. It should keep itself up and down slowly but not too high and drops too deep. Just like a hologram.

1 answer

Log in to vote
0
Answered by
aredanks 117
4 years ago

You would just change the position of your BillboardGui's Y value up and down using a loop.

Here is the basis of it:

local billboardGui = script.Parent
local hologram = billboardGui.TextLabel
while true do
    --code
end

You would use Tweening to make it smoothly move up and down. It will create a smooth holographic event.

There is also TweenPositionAndSize and TweenSize for different effects.

Example code to use TweenPosition:

hologram:TweenPosition(hologram.Position + UDim2.new(0, 2, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.2)
hologram:TweenPosition(hologram.Position - UDim2.new(0, 2, 0), Enum.EasingDirection.In, Enum.EasingStyle.Sine, 0.2)

Result:

local billboardGui = script.Parent
local hologram = billboardGui.TextLabel
while true do
    hologram:TweenPosition(hologram.Position + UDim2.new(0, 2, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.2)
    hologram:TweenPosition(hologram.Position - UDim2.new(0, 2, 0), Enum.EasingDirection.In, Enum.EasingStyle.Sine, 0.2)
end
-- since the tweening functions already have a wait parameter in them, no need to do anything like wait() unless you want to, you can change the styles and directions around
Ad

Answer this question