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

I am trying to make a Button that shows "+1 IQ" when you press it, not working?

Asked by 3 years ago

Hello,

i am trying to do this thing where when I press a TextButton, text will appear saying "+1 IQ", just for some testing, but my script wont work for some reason, when I press the TextButton nothing happens, nothing is in the output, sombody please help.

Here is the code:

local plr = script.Parent.Parent.Parent
local suffixes = {'','K','M','B','T','Qa','Qi','Sx','Sp','Oc','N','Dc','Ud','Dd','Td','Qua','Qui','Sxd',"Spd",'Ocd','Nod','Vg','UVg','DVg','TVg','qtV','QnV','SeV','SPG','OVG','NVG','TGN','UTG','DTG','tsTG','qtTG','QnTG','ssTG','SpTG','OcTG','NoAG','UnAG','DuAG','TeAG','QdAG','QnAG','SxAG','SpAG','OcAG','NvAG','CT'}
local tweenService = game:GetService("TweenService")
local b = game.StarterGui.Button.TextButton
local function format(val)
    for i=1, #suffixes do
        if tonumber(val) < 10^(i*3) then
            return math.floor(val/((10^((i-1)*3))/100))/(100)..suffixes[i]
        end
    end
end


b.MouseButton1Click:Connect(function()
        -- The object you want to tween.
        local text = script.Parent
        local random = math.random(1, 900)
        local xnew = random / 1000
        local random2 = math.random(1, 900)
        local xnew2 = random / 1000
        text.Position = UDim2.new(xnew, 0, xnew2, 0)
        text.Parent = script.Parent
        local TweenService = game:GetService("TweenService")

        local tweenInfo = TweenInfo.new(
            0.5, -- The time the tween takes to complete
            Enum.EasingStyle.Linear, -- The tween style.
            Enum.EasingDirection.Out, -- EasingDirection
            1, -- How many times you want the tween to repeat. If you make it less than 0 it will repeat forever.
            false, -- Reverse?
            0 -- Delay
        )
        local Tween = TweenService:Create(text, tweenInfo, {Rotation = 360}) -- Creates the tween with the TweenInfo and what properties you want to change
        wait(1)
        Tween:Play()
        wait(0.5)
        text.Parent = nil
    end)

In the ServerScriptStorage is also a script, the leaderboard script.

local Players = game:GetService("Players")

local function leaderboardSetup(player)
    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = player

    local Cash = Instance.new("IntValue")
    Cash.Name = "Cash"
    Cash.Value = 0
    Cash.Parent = leaderstats
end
Players.PlayerAdded:Connect(leaderboardSetup)

Here is a link to my explorer: https://ibb.co/t4Y84rC

Thanks, any help is much appreciated.

Answer this question