I have a script which changes the look of the game once you reach certain heights, however, for some reason when I go from the 50,000 point (Atmosphere) to the 200,000 point (Space) the Atmosphere bugs out and does this weird effect. When I look at it through studio or just straight up spawn in the space zone it looks fine, but when I transition from one point to the next, it bugs out. Heres a visual example:
Should look like:
Actually looks like:
Heres the transition script:
if hroot.Position.Y > 200000 then --Space
if Location ~= "Space" and
Labeldb == false
then Location = "Space" Labeldb = true
local newLabel = Label:Clone()
newLabel.Text = "|| Space ||"
newLabel.Parent = Frame
local Labels = Frame:GetChildren()
for _, v in ipairs(Labels) do
if v.Name == "Location" then
if v == newLabel then
TweenService:Create(v, TweenInfo.new(LabelTime), {
Position = UDim2.new(-1.5, 0,0.071, 0)
}):Play()
else
TweenService:Create(v, TweenInfo.new(LabelTime / 2), {
TextTransparency = 1
}):Play()
task.delay(LabelTime, function()
v:Destroy()
end)
end
end
end
task.delay(LabelTime, function()
Labeldb = false
end)
end
--Music
for _, v in ipairs(songs) do
if v == Music.Space then
TweenService:Create(v, TweenInfo.new(MusicFadeTime), {
Playing = true,
Volume = Volume
}):Play()
else
TweenService:Create(v, TweenInfo.new(MusicFadeTime), {
Volume = 0
}):Play()
end
end
--Visuals
TweenService:Create(Lighting.Atmosphere, TweenInfo.new(VisualFadeTime), {
Density = 0,
Color = Color3.new(1, 1, 1),
Decay = Color3.new(1,1,1),
Glare = 0,
Haze = 0,
Offset = .25
}):Play()
TweenService:Create(Lighting.Bloom, TweenInfo.new(VisualFadeTime), {
Intensity = 2,
Size = 20,
Threshold = 1.5
}):Play()
TweenService:Create(Lighting, TweenInfo.new(VisualFadeTime), {
Brightness = 4,
ClockTime = 19
}):Play()
elseif hroot.Position.Y > 50000 then --Atmosphere
if Location ~= "Atmosphere" and
Labeldb == false
then Location = "Atmosphere" Labeldb = true
local newLabel = Label:Clone()
newLabel.Text = "|| Atmosphere ||"
newLabel.Parent = Frame
local Labels = Frame:GetChildren()
for _, v in ipairs(Labels) do
if v.Name == "Location" then
if v == newLabel then
TweenService:Create(v, TweenInfo.new(LabelTime), {
Position = UDim2.new(-1.5, 0,0.071, 0)
}):Play()
else
TweenService:Create(v, TweenInfo.new(LabelTime / 2), {
TextTransparency = 1
}):Play()
task.delay(LabelTime, function()
v:Destroy()
end)
end
end
end
task.delay(LabelTime, function()
Labeldb = false
end)
end
--Music
for _, v in ipairs(songs) do
if v == Music.Atmosphere then
TweenService:Create(v, TweenInfo.new(MusicFadeTime), {
Playing = true,
Volume = Volume
}):Play()
else
TweenService:Create(v, TweenInfo.new(MusicFadeTime), {
Volume = 0
}):Play()
end
end