-
What I want to achieve is to make my script function every time I play the game
-
So the issue is my script doesn’t run sometimes when I run the game but I don’t know why and where its coming from?
-
Some solutions I’ve tried so far is to put waits I couldn’t figure out else what to do
So for some reason my script will work most of the time but not all and I need it to work all the time. Its only ran once. By the way if you don’t mind looking over a big script here it is and also don’t worry about fixing the whole script I just need to know why it does this. Thanks! Have a good night.
wait(.1)
local Functioned = false
local SCRIPT = function()
local Player = game:GetService('Players')
local TweenService = game:GetService('TweenService')
local Camera = game.Workspace.Camera
--local Loading = game.ReplicatedStorage.Game.LoadingScreen
local Scene = workspace.Scenes
local queue = tonumber(game:GetService("ContentProvider").RequestQueueSize)
local Loop = script.Parent.Loop
local CurrentTweene = nil
Functioned = true
local Tsec = 1
TweenService:Create(script.Parent.Black, TweenInfo.new(0.11), {BackgroundTransparency = 0}):Play()
TweenService:Create(script.Parent.Back, TweenInfo.new(Tsec), {BackgroundTransparency = 0}):Play()
TweenService:Create(script.Parent.Back.ImageLabel, TweenInfo.new(Tsec), {ImageTransparency = 0.3}):Play()
TweenService:Create(script.Parent.Back.Assets, TweenInfo.new(Tsec), {TextTransparency= 0.3}):Play()
TweenService:Create(script.Parent.Back.Creds, TweenInfo.new(Tsec), {TextTransparency = 0.3}):Play()
TweenService:Create(script.Parent.Back.Facts, TweenInfo.new(Tsec), {TextTransparency = 0}):Play()
TweenService:Create(script.Parent.Back.TextLabel, TweenInfo.new(Tsec), {TextTransparency = 0.3}):Play()
TweenService:Create(script.Parent.BackImage, TweenInfo.new(Tsec), {ImageTransparency = 0}):Play()
Loop.Value = true
repeat wait(.1) until Camera.CameraSubject ~= nil
Camera.CameraType = Enum.CameraType.Scriptable
spawn(function()
script.Parent.Parent.Choose.BackGround.Police.Button.MouseButton1Click:Connect(function(player)
local Camera = game.Workspace.Camera
TweenService:Create(script.Parent.Sound.Intensive, TweenInfo.new(3), {Volume = 0}):Play()
TweenService:Create(script.Parent.Back, TweenInfo.new(0.11), {BackgroundTransparency = 0}):Play()
script.Parent.Parent.Choose.Enabled = false
Loop.Value = false
CurrentTweene:Pause()
wait(0.10)
Camera.CameraType = Enum.CameraType.Custom
wait(1)
script.Parent.Sound.Intensive:Stop()
TweenService:Create(script.Parent.Back, TweenInfo.new(0.11), {BackgroundTransparency = 1}):Play()
end)
end)
spawn(function()
script.Parent.Parent.Choose.BackGround.Prisoner.Button.MouseButton1Click:Connect(function()
local Camera = game.Workspace.Camera
TweenService:Create(script.Parent.Sound.Intensive, TweenInfo.new(3), {Volume = 0}):Play()
script.Parent.Parent.Choose.Enabled = false
TweenService:Create(script.Parent.Back, TweenInfo.new(0.11), {BackgroundTransparency = 0}):Play()
Loop.Value = false
CurrentTweene:Pause()
Camera.CameraType = Enum.CameraType.Custom
wait(1)
script.Parent.Sound.Intensive:Stop()
TweenService:Create(script.Parent.Back, TweenInfo.new(0.11), {BackgroundTransparency = 1}):Play()
end)
end)
spawn(function()
local Val = true
while true do
wait(.1)
if queue <= 0 then
Functioned = true
if Val == true then
Val=false
wait(2)
TweenService:Create(script.Parent.Back, TweenInfo.new(Tsec), {BackgroundTransparency = 1}):Play()
TweenService:Create(script.Parent.Back.ImageLabel, TweenInfo.new(Tsec), {ImageTransparency = 1}):Play()
TweenService:Create(script.Parent.Back.Assets, TweenInfo.new(Tsec), {TextTransparency= 1}):Play()
TweenService:Create(script.Parent.Back.Creds, TweenInfo.new(Tsec), {TextTransparency = 1}):Play()
TweenService:Create(script.Parent.Back.Facts, TweenInfo.new(Tsec), {TextTransparency = 1}):Play()
TweenService:Create(script.Parent.Back.TextLabel, TweenInfo.new(Tsec), {TextTransparency = 1}):Play()
TweenService:Create(script.Parent.BackImage, TweenInfo.new(Tsec), {ImageTransparency = 1}):Play()
wait()
TweenService:Create(script.Parent.Back, TweenInfo.new(Tsec), {BackgroundTransparency = 1}):Play()
TweenService:Create(script.Parent.Back.ImageLabel, TweenInfo.new(Tsec), {ImageTransparency = 1}):Play()
TweenService:Create(script.Parent.Back.Assets, TweenInfo.new(Tsec), {TextTransparency= 1}):Play()
TweenService:Create(script.Parent.Back.Creds, TweenInfo.new(Tsec), {TextTransparency = 1}):Play()
TweenService:Create(script.Parent.Back.Facts, TweenInfo.new(Tsec), {TextTransparency = 1}):Play()
TweenService:Create(script.Parent.Back.TextLabel, TweenInfo.new(Tsec), {TextTransparency = 1}):Play()
TweenService:Create(script.Parent.BackImage, TweenInfo.new(Tsec), {ImageTransparency = 1}):Play()
if queue >= 1 then return end
wait(1.60)
TweenService:Create(script.Parent.Black.Yea, TweenInfo.new(0.11), {TextTransparency = 0}):Play()
wait(0.11)
TweenService:Create(script.Parent.Black.Icon, TweenInfo.new(0.11), {ImageTransparency = 0}):Play()
wait(0.17)
TweenService:Create(script.Parent.Black.Thanks, TweenInfo.new(0.11), {TextTransparency = 0}):Play()
wait(3)
TweenService:Create(script.Parent.Black.Yea, TweenInfo.new(0.1), {TextTransparency = 1}):Play()
TweenService:Create(script.Parent.Black.Icon, TweenInfo.new(0.1), {ImageTransparency = 1}):Play()
TweenService:Create(script.Parent.Black.Thanks, TweenInfo.new(0.1), {TextTransparency = 1}):Play()
script.Parent.Sound.Intensive:Play()
TweenService:Create(script.Parent.Sound.Intensive, TweenInfo.new(3), {Volume = 1}):Play()
wait(1)
script.Parent.Parent.Choose.Enabled = true
TweenService:Create(script.Parent.Black, TweenInfo.new(1), {BackgroundTransparency = 1}):Play()
end
end
end
end)
while task.wait() do
wait(.1)
Functioned = true
if Loop.Value == true then
wait(.1)
for i,v in pairs(Scene:GetChildren()) do
if Loop.Value == false then return end
Camera.CFrame = v["1"].CFrame
CurrentTweene = TweenService:Create(Camera,TweenInfo.new(10), {CFrame = v["2"].CFrame})
CurrentTweene:Play()
print("ENDED")
wait(10)
end
end
end
end
wait(.1)
SCRIPT()
while true do
wait(1)
if Functioned == false then
SCRIPT()
end
end
