How would I make a pop up tween wich show the amount you got when you clicked and if you click alot that there will be multiple and after a few seconds go away and they tween like from under the screen to up and stop. Can someone help me?
Open Roblox Studio and create a new place or open an existing one.
Insert a TextLabel object and position it where you want the pop-up to appear. Customize the appearance of the TextLabel as desired.
Insert a ClickDetector object and parent it to the TextLabel.
Insert a Script object and parent it to the TextLabel.
Double-click the Script object to open the code editor and write the following code:
local clickDetector = script.Parent:WaitForChild(“ClickDetector”)
local textLabel = script.Parent
local function showPopUp(amount)
local popUp = textLabel:Clone()
popUp.Text = “+” … amount
popUp.Position = UDim2.new(0, 0, 1, 0) – Position it below the screen initially
popUp.Parent = textLabel.Parent
local tweenInfo = TweenInfo.new(
1, -- Duration
Enum.EasingStyle.Linear, -- Easing style
Enum.EasingDirection.Out, -- Easing direction
0, -- Number of times to repeat (-1 for infinite)
false, -- Reverse the tween?
0 -- Delay before starting the tween
)
local tween = game:GetService("TweenService"):Create(popUp, tweenInfo, {Position = UDim2.new(0, 0, 0, 0)})
tween:Play()
wait(3) -- Wait for 3 seconds
popUp:Destroy()
end
clickDetector.MouseClick:Connect(function()
local amount = math.random(1, 10) – Generate a random amount
showPopUp(amount)
end)
This script listens for mouse clicks on the TextLabel using the ClickDetector’s MouseClick event. When a click is detected, a pop-up is created by cloning the original TextLabel and animating it using the TweenService. The pop-up displays a randomly generated amount. After 3 seconds, the pop-up is destroyed.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.