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

Static Image Array Flashing For Mobile?

Asked by 3 years ago
Edited 3 years ago

Hello.

I am in the process of making a horror game, and in that horror game, there are parts where your screen goes through an animated frame made out of 9 static frames, that are all different. Through an array, this works perfectly fine and it animates.

For PC users, the static works fine and no issues are found, however, for mobile, it's a completely different story.

Instead of smoothly animating, it makes a continuous flash between the frames, causing an epilepsy like flashing, and due to that it cannot be left in the game like that.

The thing that confuses me the most of it is that it only happens on mobile. The game has a main menu which also has the animated static, however, on the menu the static is fine for mobile as well.

It's very confusing to me and I have no idea why.

Things to keep in note - The player is teleported via a play button to a secondary place from the Main Menu - The animated static array in the main menu works perfectly fine for both mobile and pc - The animated static array in the main game works perfectly fine for pc but flashes for mobile

Please let me know if any of the links below do not work. EDIT: The links should be fixed and watchable

What a PC User Sees: Jumpscare warning

https://gyazo.com/5e002feb8f86b3de9a925f571aeeaf20

What a Mobile User Sees: Jumpscare warning and Epilepsy Warning (Don't mind timing lag, that's related to another issue)

https://gyazo.com/09c7d47252e5fecb18fac75bfa4162e1

From what you can see there, as you can see, the flashing is pretty bad. Again, I'm unsure what causes this, and all I have is an image frame that's turned into an animated frame by this script:

local StaticFrame = script.Parent
local UI = StaticFrame.Parent

local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvents = ReplicatedStorage.RemoteEvents

local StartStatic = RemoteEvents.StartStatic
local EndStatic = RemoteEvents.EndStatic

local TeleportService = game:GetService("TeleportService")
local PlaceID = 6429016632

local Static = false
local TextureAssetIds = {
    6429337491,
    6429337709,
    6429338250,
    6429338751,
    6429338967,
    6429339175,
    6429339476,
    6429339678,
    6429339898
}

local function TraverseFrames(Frames)
    for _, Frame in pairs(Frames) do
        StaticFrame.Image = "rbxassetid://" .. Frame
        wait(0.1)
    end
end

local function EnableStatic()
    Static = true
    StaticFrame.Visible = true
    while (Static) do
        TraverseFrames(TextureAssetIds)
        if not (Static) then
            break
        end
    end
end

local function DisableStatic()
    Static = false
    StaticFrame.Visible = false
end

local function GameOver()
    StaticFrame.ImageTransparency = 0
    wait(2)
    for FadeGameOver = 1, 0, -0.1 do
        StaticFrame.GameOver.TextStrokeTransparency = FadeGameOver
        StaticFrame.GameOver.TextTransparency = FadeGameOver
        wait()
    end
    StaticFrame.GameOver.TextStrokeTransparency = 0
    StaticFrame.GameOver.TextTransparency = 0
    wait(1)
    StaticFrame.GameOver.Text = "Waiting for server..."
    TeleportService:Teleport(
        PlaceID, Player
    )
end

EndStatic.OnClientEvent:Connect(DisableStatic)
StartStatic.OnClientEvent:Connect(EnableStatic)
RemoteEvents.GameOver.OnClientEvent:Connect(GameOver)

Essentially, the static is meant to start when the StartStatic Remote is fired from the server to the client, to make the static appear.

I'm not sure how to fix this issue nor am I sure on what causes this bug. If I could get some help with this, it would be great.

Thanks!

Answer this question