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

Date value not correct?

Asked by 5 years ago

I have this script and it works, but it just doesn't actually do the "downtime" check. Basically, I can repeatedly click the target and it will run, without checking if Today is > or <.

local unhappystrings = {"go away please","man i just got paid","leave this place","bruh"}
local happystrings = {"Yaay! Happy fun time! +1 Token","Gg, mate. +1 Token","I killed your mother"}

local Rand = Random.new(os.time())

game.ReplicatedStorage.Click.OnServerEvent:connect(function(Player,Target)
    if Target.Parent == script.Parent then
        if Player:FindFirstChild("Tokenman") ~= nil then
            local Today = math.floor(os.time()/(60*60*24))

            if Player.Tokenman.Value < Today then
                local HString = happystrings[math.random(1,#happystrings)]
                game.ReplicatedStorage.Currency:FireClient(Player,script.Parent.Hitbox,HString,Color3.new(0.6,0.6,0.6),3)
                Player.Tokens.Value = Player.Tokens.Value + 1
                wait(30)
            else
                local UString = unhappystrings[math.random(1,#unhappystrings)]
                game.ReplicatedStorage.Currency:FireClient(Player,script.Parent.Hitbox,UString,Color3.new(0.6,0.6,0.6),3)
            end
        end 
    end
end)

0
Try to look the values of "Today" and "Player.Tokenman.Value", maybe you find the error. cailir 284 — 5y

Answer this question