Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Rain falling AFTER message dissapears?

ignore lines 1-14

how would i make the message to show without stopping rain? my problem is that first the message shows, but rain starts only after sign is completely invisible, help please

game:GetService("Players").PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(Message)
		if Message == "RainTest" and player.Name == "SuperBeeperman" then
		local RainFalling = true
        local Model = script.Parent:FindFirstChild("AllEssenceSets")
        local cModel = Model:Clone()
        cModel.Parent = game.Lighting
        Model:Destroy()
        local Sky = game.ServerStorage:FindFirstChild("RainyBoi")
        local RealSky = Sky:Clone()
        RealSky.Parent = game.Lighting
        local Puddles = workspace.Parent.Lighting:FindFirstChild("AllPureWaterSets")
        local TruePuddles = Puddles:Clone()
        TruePuddles.Parent = script.Parent
        local coco = player.PlayerGui.Announcements.Absorbing
		coco.TextLabel.Text = player.Name.." has invoked some rain!"
		coco.Visible = true
		wait(3)
		coco.TextLabel.Visible = false
		coco.BackgroundTransparency = 0.51
        wait(0.001)
        coco.BackgroundTransparency = 0.52
        wait(0.001)		
        coco.BackgroundTransparency = 0.53
        wait(0.001)
		coco.BackgroundTransparency = 0.54
        wait(0.001)
		coco.BackgroundTransparency = 0.55
        wait(0.001)
		coco.BackgroundTransparency = 0.56
        wait(0.001)
		coco.BackgroundTransparency = 0.57
        wait(0.001)
		coco.BackgroundTransparency = 0.58
        wait(0.001)
		coco.BackgroundTransparency = 0.59
        wait(0.001)
		coco.BackgroundTransparency = 0.60
        wait(0.001)
		coco.BackgroundTransparency = 0.61
        wait(0.001)
		coco.BackgroundTransparency = 0.62
        wait(0.001)
		coco.BackgroundTransparency = 0.63
        wait(0.001)
		coco.BackgroundTransparency = 0.64
        wait(0.001)
		coco.BackgroundTransparency = 0.65
        wait(0.001)
		coco.BackgroundTransparency = 0.66
        wait(0.001)
		coco.BackgroundTransparency = 0.67
        wait(0.001)
		coco.BackgroundTransparency = 0.68
        wait(0.001)
		coco.BackgroundTransparency = 0.69
        wait(0.001)
		coco.BackgroundTransparency = 0.70
        wait(0.001)
		coco.BackgroundTransparency = 0.71
        wait(0.001)
		coco.BackgroundTransparency = 0.72
        wait(0.001)		
		coco.BackgroundTransparency = 0.73
        wait(0.001)
		coco.BackgroundTransparency = 0.74
        wait(0.001)
		coco.BackgroundTransparency = 0.75
        wait(0.001)
		coco.BackgroundTransparency = 0.76
        wait(0.001)
        coco.BackgroundTransparency = 0.77
        wait(0.001)		
        coco.BackgroundTransparency = 0.78
        wait(0.001)
		coco.BackgroundTransparency = 0.79
        wait(0.001)
		coco.BackgroundTransparency = 0.80
        wait(0.001)
		coco.BackgroundTransparency = 0.81
        wait(0.001)
		coco.BackgroundTransparency = 0.82
        wait(0.001)
		coco.BackgroundTransparency = 0.83
        wait(0.001)
		coco.BackgroundTransparency = 0.84
        wait(0.001)
		coco.BackgroundTransparency = 0.85
        wait(0.001)
		coco.BackgroundTransparency = 0.86
        wait(0.001)
		coco.BackgroundTransparency = 0.87
        wait(0.001)
		coco.BackgroundTransparency = 0.88
        wait(0.001)
		coco.BackgroundTransparency = 0.89
        wait(0.001)
		coco.BackgroundTransparency = 0.90
        wait(0.001)
		coco.BackgroundTransparency = 0.91
        wait(0.001)
		coco.BackgroundTransparency = 0.92
        wait(0.001)
		coco.BackgroundTransparency = 0.93
        wait(0.001)
		coco.BackgroundTransparency = 0.94
        wait(0.001)
		coco.BackgroundTransparency = 0.95
        wait(0.001)
		coco.BackgroundTransparency = 0.96
        wait(0.001)
		coco.BackgroundTransparency = 0.97
        wait(0.001)		
		coco.BackgroundTransparency = 0.98
        wait(0.001)
		coco.BackgroundTransparency = 0.99
        wait(0.001)
		coco.BackgroundTransparency = 1
        local WaterDrop = game.ServerStorage:FindFirstChild("WaterDrop")
        local WaterDropHeight = 283

        local function createWaterDropCopy()
        local WaterDropCopy = WaterDrop:Clone()
        WaterDropCopy.Parent = game.Workspace
        local xPosition = math.random(-429,332)
        local zPosition = math.random(-358,162)
        WaterDropCopy.Position = Vector3.new(xPosition, WaterDropHeight, zPosition)
        end

        while RainFalling == true do
        createWaterDropCopy()
        wait(0.00000000001)
        end

		end
	end)
end)

1 comment

0

Please use for loop from line 20 - 118

1 answer

Use spawn() to make the code run in a separate thread. Also you can use a for loop to make your code smaller:

game:GetService("Players").PlayerAdded:Connect(function(player)
    player.Chatted:Connect(function(Message)
        if Message == "RainTest" and player.Name == "SuperBeeperman" then
        local RainFalling = true
        local Model = script.Parent:FindFirstChild("AllEssenceSets")
        local cModel = Model:Clone()
        cModel.Parent = game.Lighting
        Model:Destroy()
        local Sky = game.ServerStorage:FindFirstChild("RainyBoi")
        local RealSky = Sky:Clone()
        RealSky.Parent = game.Lighting
        local Puddles = workspace.Parent.Lighting:FindFirstChild("AllPureWaterSets")
        local TruePuddles = Puddles:Clone()
        TruePuddles.Parent = script.Parent
        local coco = player.PlayerGui.Announcements.Absorbing
        coco.TextLabel.Text = player.Name.." has invoked some rain!"
        coco.Visible = true
        wait(3)
        coco.TextLabel.Visible = false
        spawn(function()
            for i=0.5,1.01,0.01 do
                coco.BackgroundTransparency = i
                wait(0.001)
            end
        end)
        local WaterDrop = game.ServerStorage:FindFirstChild("WaterDrop")
        local WaterDropHeight = 283

        local function createWaterDropCopy()
        local WaterDropCopy = WaterDrop:Clone()
        WaterDropCopy.Parent = game.Workspace
        local xPosition = math.random(-429,332)
        local zPosition = math.random(-358,162)
        WaterDropCopy.Position = Vector3.new(xPosition, WaterDropHeight, zPosition)
        end

        while RainFalling == true do
        createWaterDropCopy()
        wait(0.00000000001)
        end

        end
    end)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.