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.
COMMUNITY QUESTION
Make text label in BillbroadGui shifting position up and down by a few pixels?
1 answer
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
This discussion is preserved as it was. New answers, comments, and votes are closed.
