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

Making a number rise and then disappear?

Asked by 4 years ago
Edited 4 years ago

Hey, i am trying to make a number float up and then disappear, but i have it set up so where when i click the button, the text will go to the mouse's position, but i don't know how to make it float up without it tracking the mouse. I have a idea of what i want to happen but i dont know how to put it.

Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()

local function NumberHappen()
    local Text = Instance.new("TextLabel")
    Text.Name = "Text"
    Text.Parent = script.Parent.Parent
    Text.Position = UDim2.new(0,Mouse.x,0,Mouse.y)
    Text.Size = UDim2.new(0,0,0,0)
    Text.Text = "1+"
    Text.BackgroundTransparency = 1
    Text.TextColor3 = Color3.new(255,255,255)
    Text.TextSize = 32
    wait(1)
    Text:Destroy()
end

script.Parent.MouseButton1Click:Connect(function()
    NumberHappen()
end)
0
Can you provide the script? BloxRoxe 109 — 4y

1 answer

Log in to vote
0
Answered by
BloxRoxe 109
4 years ago

Is this what you mean?

Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()

local function NumberHappen()
    local x = Mouse.x
    local y = Mouse.y
    local Text = Instance.new("TextLabel")
    Text.Name = "Text"
    Text.Parent = script.Parent.Parent
    Text.Position = UDim2.new(0,x,0,y)
    Text.Size = UDim2.new(0,0,0,0)
    Text.Text = "1+"
    Text.BackgroundTransparency = 1
    Text.TextColor3 = Color3.new(255,255,255)
    Text.TextSize = 32

    for i = 1, 20 do -- change 20 to your liking 
        Text.Position = Text.Position - UDim2.new(0,0,0,5) -- change 5 to your liking
        wait()
    end
    Text:Destroy()


end

script.Parent.MouseButton1Click:Connect(function()
    NumberHappen()
end)

0
Thank u so much :) woahsnake 4 — 4y
Ad

Answer this question