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

When i enable these scripts after a while it does nothing. Why?

Asked by 6 years ago
Edited 6 years ago

They are both activated by a once every 24 hours script that I have seen enable them. Both scripts are local.

wait (20)
script.Parent:TweenPosition(UDim2.new(.500,.200,.45,0),"In","Quad", 3)

while wait() do
if game.Workspace.YesOrNo.Value == 1 then
    wait (3)
script.Parent:TweenPosition(UDim2.new(.500,.200,-1,0),"Out","Quad", 3)
wait(0.5)
end
end

2nd script:

local Raritytimes = { --How rare it is. How lower the value. Less chanse you can get it.
    ["Common"] = 7,
    ["Uncommon"] = 5,
    ["Rare"] = 3,
    ["Legendary"] = 1,
}

wait (22.1)

local CrateInude = false

local function opencrate(Chance)
    if CrateInude == false then
        CrateInude = true
        local Itemss = {}
        local frametimes = math.random(30,32)
        local rewardbutton
        for _,Item in pairs(game.ReplicatedStorage.Itemss:GetChildren()) do
            local RarNumber = Raritytimes[Item.Rarity.Value] or 1
            local Times = math.max(RarNumber+Chance)
            for i = 1,Times do
                table.insert(Itemss,Item)
            end
        end

        math.randomseed(tick())    

        for i = 1,frametimes+5 do
            local item = Itemss[math.random(#Itemss)]
            local newframe = script.Parent.Unboxing.SampleItem:Clone()
            newframe.Visible =true
            newframe.Parent = script.Parent.Unboxing.inner
            newframe.Icon.Image = item.Image.Value
            newframe.ItemName.Text = item.Name
            newframe.Position = UDim2.new(0,100*(i-1),0,0)
            if i == frametimes then
                rewardbutton = newframe
            end
        end
        for num = 1,(rewardbutton.Position.X.Offset - (255+math.random(-40,40)))/15 do
            for i,v in pairs(script.Parent.Unboxing.inner:GetChildren()) do
                v.Position = UDim2.new(0,v.Position.X.Offset-15,0,0)
                if v.Position.X.Offset <= -150 then
                    v:Destroy()
                end
            end
            wait(0.01 * 1.05 ^ (num-105)/2)
script.Tick:Play()
        end
    end
game.Workspace.YesOrNo.Value = 1
game.Workspace.AlreadyGone.Value = 1
wait (0.1)
script.Tada:Play()
end

opencrate(0)

game.Players.PlayerAdded:connect(function(plr)
end)
local DataStore = game:GetService('DataStoreService'):GetDataStore('DailyRewards')
local TimePeriod = 86400

game.Players.PlayerAdded:connect(function(plr)
local currenttime = os.time()
local RecordedPreviousTime = DataStore:GetAsync(plr.userId)
if RecordedPreviousTime then
if type(RecordedPreviousTime) == 'number' then
local timeelapsed = currenttime - RecordedPreviousTime
print(timeelapsed)
if timeelapsed <= TimePeriod then
DataStore:SetAsync(plr.userId, os.time())
game.StarterGui.ScreenGui.Unboxing.LocalScript.Disabled = false
game.StarterGui.ScreenGui.LocalScript.Disabled = false
else
    print("Not 24 Hours yet!")
end
end
end
end)

Answer this question