i have a loop that should turn off when my value becomes false, i try to set it to false but it stays true
local Rec = false
local function InitFolder(Type, Plr, FileName)
--local Folder = Instance.new("Folder")
--Folder.Name = "Untitled"..Type
--Folder.Parent = Plr
--local VIDDATA = Instance.new("Folder")
--VIDDATA.Parent = Folder
--VIDDATA.Name = "VideoData"
--if Type == "RBV" or Type == "RBV2" then
-- local SoundFolder = Instance.new("Folder")
-- SoundFolder.Parent = Folder
-- SoundFolder.Name = "Sounds"
--end
--New
local Folder = game.ReplicatedStorage:FindFirstChild("Untitled."..Type):Clone()
Folder.Parent = Plr.Recordings
Folder.Name = FileName.."."..Type
return Folder
end
local function Record(plr, FileFormat, FileName)
if FileFormat == "RBV" then
Rec = true
local Location = InitFolder("RBV", plr, FileName)
print(Rec)
while Rec == true do
local FolderClone = game.ReplicatedStorage.TEMP.RBV.Frame:Clone()
print("looking for: "..FileName.."."..FileFormat)
FolderClone.Parent = Location
for _, V in game.Workspace:GetDescendants() do
if V:IsA("BasePart") or V:IsA("UnionOperation") or V:IsA("MeshPart") or V:IsA("Decal") or V:IsA("Texture") then
if not V:IsA("Terrain") then
local ObjectClone = V:Clone()
ObjectClone.Parent = FolderClone
--FolderClone.CamPos.Value = game.Workspace.CurrentCamera.CFrame
end
end
end
task.wait(0.01)
end
elseif FileFormat == "RBV2" then
Rec = true
local Location = InitFolder("RBV2", plr, FileName)
while Rec == true do
end
elseif FileFormat == "RLV" then
Rec = true
local Location = InitFolder("RLV", plr, FileName)
while Rec == true do
end
end
end
game.ReplicatedStorage:WaitForChild("Record").OnServerEvent:Connect(function(plr, P1, P2)
Record(plr, P1, P2)
task.wait(5)
Rec = false
end)