How many parts does your map have btw? Are the houses like the original ones with tons of parts or are they optimized?
You could also use fog and the only tween nearby parts out.
How many parts does your map have btw? Are the houses like the original ones with tons of parts or are they optimized?
You could also use fog and the only tween nearby parts out.
I optimized the houses, it’s not having lots of parts like the original one.
You just fade the screen to a black GUI but place the character over the GUI with a viewport frame. Note the viewport frame character would have noticeably lower resolution.
Yes, i know that and that’s why i don’t want to use viewport frame.
All you need to do is set up the viewport frame to be at the character’s position in relation to the camera. Clone the character and place in the viewport frame. Then hide the real character instead of the whole map.
When viewport frames were initially released a lot of people did ‘see through walls’ for shooting games, or x-ray vision type stuff. You could probably find some code on this since its basically the same thing.
Any more help? how can i fix this please.
Try this:
local presetTweenInfo = TweenInfo.new(WaitTime2, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out)
local tweenGoal = {Transparency = 1}
for i, v in workspace.MAP:GetDescendants() do
if v:IsA("BasePart") or v:IsA("Texture") then
if i % 100 == 0 then
task.wait()
end
TweenService:Create(v, presetTweenInfo, tweenGoal):Play()
end
end
ive made this fading effect before and I agree with @SelDraken that you should use viewport frames than looping every thing in the workspace
local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local IsFadingDark = false
local function GetScreenEffects()
local PlayerGui = Players.LocalPlayer.PlayerGui
if PlayerGui then
local ScreenEffects:ScreenGui = PlayerGui:FindFirstChild("ScreenEffects")
if not ScreenEffects then
ScreenEffects = Instance.new("ScreenGui")
ScreenEffects.Name = "ScreenEffects"
ScreenEffects.DisplayOrder = 10000
ScreenEffects.IgnoreGuiInset = true
ScreenEffects.Parent = PlayerGui
end
return ScreenEffects
end
end
local function GetFadeFrame()
local ScreenEffects:ScreenGui = GetScreenEffects()
if ScreenEffects then
local FadeFrame:ViewportFrame = ScreenEffects:FindFirstChild("FadeFrame")
if not FadeFrame then
FadeFrame = Instance.new("ViewportFrame")
FadeFrame.Name = "FadeFrame"
FadeFrame.BackgroundTransparency = 1
FadeFrame.Size = UDim2.new(1, 0, 1, 0)
FadeFrame.Position = UDim2.new(0, 0, 0, 0)
FadeFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
FadeFrame.Parent = ScreenEffects
local WorldModel = Instance.new("WorldModel")
WorldModel.Name = "WorldModel"
WorldModel.Parent = FadeFrame
local Camera = Instance.new("Camera")
Camera.Parent = WorldModel
FadeFrame.CurrentCamera = Camera
end
return FadeFrame
end
end
local function FadeDark(Fade:boolean, Duration:number)
if Fade then
local Character = Players.LocalPlayer.Character
if Character then
IsFadingDark = true
local FadeFrame = GetFadeFrame()
Character.Archivable = true
local FakeCharacter = Character:Clone()
FakeCharacter.Name = "FakeCharacter"
FakeCharacter.Parent = FadeFrame.WorldModel
Character.Archivable = false
local Parts:{BasePart} = {}
local FakeParts:{BasePart} = {}
for Index, Value in ipairs(Character:GetDescendants()) do
if Value:IsA("BasePart") then
Parts[Value.Name..tostring(Value.Size)] = Value
end
end
for Index, Value in ipairs(FakeCharacter:GetDescendants()) do
if Value:IsA("BasePart") then
FakeParts[Value.Name..tostring(Value.Size)] = Value
elseif Value:IsA("Motor6D") then
Value:Destroy()
end
end
TweenService:Create(FadeFrame, TweenInfo.new(Duration, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out), {BackgroundTransparency = 0, ImageTransparency = 0}):Play()
repeat
for Index, Value in pairs(FakeParts) do
Value.CFrame = Parts[Index].CFrame
end
FadeFrame.CurrentCamera.CFrame = Workspace.CurrentCamera.CFrame
RunService.RenderStepped:Wait()
until
not IsFadingDark and FadeFrame.BackgroundTransparency == 1
FakeCharacter:Destroy()
end
else
TweenService:Create(GetFadeFrame(), TweenInfo.new(Duration, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out), {BackgroundTransparency = 1, ImageTransparency = 1}):Play()
IsFadingDark = false
end
end
-- Testing here
local TestEnabled = false
game.UserInputService.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.K then
if TestEnabled then
TestEnabled = false
else
TestEnabled = true
end
FadeDark(TestEnabled, 2) -- Testing Call
end
end)
press ‘K’ to test the effect
all you need to do is just call the function ‘FadeDark’ to enable or disable it
Edit Again: I added a parameter for the ‘WaitTime2’ in your code for the tween duration
heres what it looks like:
I’ll try this tomorrow! Thanks for your reply.
Thanks a lot. This works very good!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.