Did I make any mistakes? Do you have questions or suggestions? Post a comment to let me know! ✨ Roblox Game Development Tutorial Playlists ► www.emancyphur.com/tutorials/playlists
*Video Timestamps / Chapters* 0:00 How to add Atmosphere into your game 0:19 How to customize Atmosphere - 0:40 How the Atmosphere’s properties work (Sub-chapters) 0:41 How the Density and Offset Properties Work 1:15 How the Haze and Color Properties Work 1:45 How the Glare and Decay Properties Work 2:27 Other Important Lighting Properties - 2:38 Scripting Atmosphere 3:26 Creating Atmosphere Zones / Regions 5:13 Customizing the Atmosphere Zones 7:16 Coding the Atmosphere Zones
Yo what is container meant to be bc you didnt make it a variable nor anything so am i suppose to put smthin in it or whatever? reply bck pls @Emancyphur
also im getting the error Players.GuguTDM.PlayerScripts.LocalScript:52: Expected ')' (to close '(' at line 41), got 'container' ive tried fixing it but a different error just keeps coming up.
@@L1s3rg1c If you're talking about the "container" at 9:03 in the video, that refers to the object that's sent into the function (which in that case, is every item that is added to the first layer of the "atmosphereZones" folder. For reference, one of the ways that function is activated is when the "atmosphereZones.ChildAdded" event is fired at the bottom of the LocalScript). As far as the error you've encountered, make sure you didn't forget to add any closing parentheses anywhere. For instance, at "local function CreateZone(container)", the closing parentheses is immediately after the word "container". If that didn't answer your question(s), please explain more, including the section of code that's erroring (or the entire LocalScript to be able to more easily identify what isn't working properly) in your next reply if it's still not working as intended. Remember that the fully working and completed product from the tutorial is also available in the description (or right here, for your convenience): 1⃣ [Atmosphere Resources - Setup Model w/Source Code] create.roblox.com/marketplace/asset/10348226901 Alternatively, the source code and an optional model download can be found on this GitHub Repository ► github.com/Emancyphur/Roblox-Studio-Tutorials
@@Emancyphur the line that is giving me an error is container.Destroying:Connect(DestroyZone) in StarterPlayerScripts inside the local file thank you for acknowledging my question.
Only needed the first bit to figure out why atmosphere wasn't working, but just let it play through the rest of the tutorial. It sounds like you put a lot of work into this, and it is very well done. Thank you for sharing your knowledge!
I really appreciate the kind words! I didn't connect the dots until a few days after you posted your comment, but your channel name sounded familiar and when I searched for your profile on Roblox and checked the games you've created... I realized that I played your "Prison Tycoon" game back in 2012!!! I have several of the badges from that game that appear on Page 117 in my inventory (out of 119 pages) and because one of the Roblox browser extensions I have showcases the "Unlocked" date for earned badges, it says that I obtained most of those badges on "September 22, 2012", which was pretty much within the first month I had started playing Roblox. And then out of all the badges, I earned the "Bunny VIP Badge" along with a few others the next year on "August 4, 2013" haha. With all of that in mind, it's so crazy cool to know that you've watched one of my tutorials, and such a random coincidence given it has been over a decade since I played one of your games. It's not very often that something like that happens -- really puts into perspective how small of a world we're living in. It's also awesome to know that you're still creating stuff on Roblox to this day! Are you working on any new games of your own or mainly experimenting with Roblox Studio's features and creating small projects (which is pretty much what I do)?
Hey! It really must be a small world after all. It makes me so happy hearing things like this. That’s awesome to think that a decade ago you were playing my game, and now I am learning from your tutorial. Personally, I fell off since the early 2010s as far as making games, but every so often I do make a new game either by myself or with a buddy. I usually start a lot of projects, but never finish them. I also have so many games that I want to make but, sadly, I just never get to drive to do it. I’m working full time as a software engineer, so that takes up much of my time, but here and there I do have spouts of Roblox. I hope you continue your journey with making projects and tutorials, because it really seems you’re good at what you do! I appreciate you reaching out!
Thank you so much! Replaying this video over and over again to know what to do thanks i've been searching how to change sky etc for my horror game! very underrated
I managed to Advanced the ZonePlus Module to not only do Atmospheres, but PPE (Post Processing Effects),Ssounds, LightingService Properties, Clouds, TerrainService Properties, and i plan to add more, but for now this is more than enough. I plan to Release this to the Marketplace either as a Model you can insert or a a simple and easy Plugin with Settings/Configurations, but i would need to Polish and Secure it and fix some of the bugs with it.
Super useful tutorial. One thing I don't think you mentioned though is that by default, these zones need to be in the default collision group. Was stuck on this one for a little until I noticed in the output that error message for it.
Thank you so much for this tutorial man it helped alot, uh and also i wondered if it was possible to change the depth of field with the atmosphere when the player enters a new zone, and how. Thank you !
It would be possible to update the Depth Of Field at the same time; this would require some changes to the LocalScript code as well as having a way of defining what the new values for each particular zone should be. I answered a similar question like this before but for the ColorCorrectionEffect, so my response here will effectively be the same as that but repurposed to work with the DepthOfField: The simplest way of achieving this with making minimal changes to the system would start by adding a customized DepthOfField object directly into the zone within the "AtmosphereZones" folder. Additionally, make sure that a copy of the original Depth Of Field (configured with the settings that it should have when the player is not in any custom zones) is kept in a spot that is easy for the LocalScript to reference so that the LocalScript will be able to change it back when the player exits a custom zone. For this example, I'll keep it directly in the ReplicatedStorage and it'll be called "OriginalDepthOfFieldEffect". Next, the sections of code that would need to be updated in the LocalScript are above and within the functions activated from the "localPlayerEntered" & "localPlayerExited" events. The main purpose of the changes will be to check if the custom zone that the player has entered has a DepthOfFieldEffect, and if so, we'll loop through all of its properties and then replace the current DepthOfFieldEffect's properties with the brand new one. If you need any additional clarification about how the code works, feel free to ask! Here's what the entire LocalScript code would look like after making those changes: -- New LocalScript code local ReplicatedStorage = game:GetService("ReplicatedStorage") local Lighting = game:GetService("Lighting") local TweenService = game:GetService("TweenService") local Zone = require(ReplicatedStorage.Zone) if not Lighting:FindFirstChildOfClass("Atmosphere") then warn("There wasn't an Atmosphere object in the Lighting! Creating a new one...") local newAtmosphere = Instance.new("Atmosphere") newAtmosphere.Name = "Atmosphere" newAtmosphere.Parent = Lighting end local Atmosphere = Lighting.Atmosphere local atmosphereZones = workspace.AtmosphereZones local defaultAtmosphere = { Density = Atmosphere.Density, Offset = Atmosphere.Offset, Color = Atmosphere.Color, Decay = Atmosphere.Decay, Glare = Atmosphere.Glare, Haze = Atmosphere.Haze } --- local function UpdateDepthOfField(newDepthOfFieldEffect) local currentDepthOfFieldEffect = Lighting:FindFirstChildOfClass("DepthOfFieldEffect")
local DepthOfFieldEffectTransition = TweenService:Create(currentDepthOfFieldEffect, TweenInfo.new(1), DepthOfFieldEffectProperties) -- Update the "TweenInfo.new(1)" with your preferred settings to customize how the values of the DepthOfFieldEffect will change (how quickly and the EasingStyle/Direction) DepthOfFieldEffectTransition:Play() end local function CreateZone(container) local customZone = Zone.new(container) customZone:bindToGroup("EnterOnlyOneZoneAtATime")
customZone.localPlayerEntered:Connect(function() local DepthOfFieldEffectCheck = container:FindFirstChildOfClass("DepthOfFieldEffect") if DepthOfFieldEffectCheck then UpdateDepthOfField(DepthOfFieldEffectCheck) end
local transition = TweenService:Create(Atmosphere, TweenInfo.new(1), container:GetAttributes()) transition:Play() end)
customZone.localPlayerExited:Connect(function() local ReplicatedStorage = game:GetService("ReplicatedStorage") local OriginalDepthOfFieldEffect = ReplicatedStorage.OriginalDepthOfFieldEffect -- This and the line of code above could be added to the top of the LocalScript if you'd like
UpdateDepthOfField(OriginalDepthOfFieldEffect)
local transition = TweenService:Create(Atmosphere, TweenInfo.new(1), defaultAtmosphere) transition:Play() end)
---
local connection
local function DestroyZone() customZone:unbindFromGroup("EnterOnlyOneZoneAtATime") customZone:destroy()
connection:Disconnect() connection = nil end
connection = container.AncestryChanged:Connect(function() if container.Parent ~= atmosphereZones then DestroyZone() end end)
container.Destroying:Connect(DestroyZone) end for _, container in ipairs(atmosphereZones:GetChildren()) do CreateZone(container) end atmosphereZones.ChildAdded:Connect(CreateZone) --[[ This is Episode 10 of Emancyphur's Roblox Studio Tutorial Series! The full list of instructional scripts from this series can be found through the description of the Roblox group that posted this model. ]]--
hey dude, massive thank you for your help! (idk if this is too much, but) I really appreciate you taking the time to respond to my question on this video. It was kind of surprising to see you reply, especially since it’s a two-year-old video. It’s awesome to see how dedicated and patient you are, not just in the comments but also on Discord and elsewhere. Your clear, in-depth responses really stand out, and it’s something I genuinely have come to respect. Thanks for being so humble and putting in the effort to assist everyone. It truly makes a difference for alot of new developers, just like me
It's included with the setup model in the "Resources" section of the description (I'll link it at the end of this comment, too). If you get it from the model on the Roblox website, it can be found via the Atmosphere Resources folder -> Adding Attributes Code -> Attributes Command Bar Code (inside of a LocalScript). If you get it from the GitHub Repository, it's currently found via Roblox Studio Tutorial Series -> Episodes 1-100 -> Episodes 1-10 -> [Last Folder] Episode 10 - Atmosphere -> Attributes Command Bar Code. 1⃣ [Atmosphere Resources - Setup Model w/Source Code] www.roblox.com/library/10348226901 Alternatively, the source code and an optional model download can be found on this GitHub Repository ► github.com/Emancyphur/Roblox-Studio-Tutorials
I have plans to remake the basic loadout system tutorial as well as to create an advanced version of it that has much more functionality as well as data saving. The remake of the existing tutorial will come first; it will likely take some time before I get to creating the advanced tutorial since I intend to create an individual tutorial specifically about saving data prior to creating any tutorials that involve DataStores.
Are you referring to the Custom Atmosphere Zones not working at all, or something else from the video? As far as I'm aware, nothing has changed with how it works since the video's release. Please check the Output to see if there are any errors occurring related to the scripts from the video. I'd also recommend taking a look at the setup model in the description and comparing the custom zones provided there to see if there's any differences between that and the ones you created. I checked to make sure that it still works before replying to your comment, and it still seems to be functioning correctly when testing it in a brand new place without anything else added to the game. I'd recommend using the custom zones provided (as well as the provided LocalScript for the StarterPlayerScripts in case there are any discrepancies between that and if you wrote it manually while watching the video) so you could modify the custom zones to the desired values to get everything working more quickly.
I got lost from 6:07 to the end. You explained things amazingly and went through all the steps before that, but when you started to not give much context i got very confused
I appreciate the feedback! Later in this comment, I'll try to explain that half of the video more clearly to make it easier to understand. Before getting to that, I want to let you know that there’s a completed version of the Custom Atmosphere Zones system from this tutorial (with written instructions) in the "Resources" section of the video description (I'll also link it right after this paragraph) that you can use and reference in case that's easier than following along with the video. With that out of the way, if you have any additional questions after reading through the rest of this comment, please reply to this comment to let me know! 1⃣ [Atmosphere Resources - Setup Model w/Source Code] create.roblox.com/marketplace/asset/10348226901 Alternatively, the source code and an optional model download can be found on this GitHub Repository ► github.com/Emancyphur/Roblox-Studio-Tutorials --- *Section of the comment where I try to explain the last half of the video more clearly starts here!* The section of the video from 5:50 until 6:55 explains two different ways to add Attributes (which are essentially custom properties) to the Atmosphere Zones we created. We're doing this for two main reasons. The first reason is because the LocalScript will need to know which properties of the Atmosphere (such as the Color, Offset, Density, etc.) need to be updated and what the new values will be updated to when a player enters the zone. The second reason is because Attributes are more user-friendly than some of the other options (which could have included creating ValueObjects such as NumberValue and Color3Value, which would have likely needed to be stored within the Atmosphere Zones, creating clutter and being more difficult to find since it would appear in the Explorer and be mixed among the parts that make up the zone. Another option could have been to define the new values inside of the script, but that is not as intuitive because over time, it'd be more difficult to know which lines of code correspond with each zone in the AtmosphereZones folder). By creating Attributes for each of the zones, developers can select the zone they want to review / update and then scroll to the bottom of the Properties window to be immediately more certain about how the Atmosphere will appear when entering each zone (without needing to select individual ValueObjects separately or search through an entire script) while also being able to quickly and easily update those values whenever they'd like. In order to create those Attributes for each of the zones, I outlined two different options. The first way (shown from 6:02 to 6:21 in the video) utilizes code to automatically create Attributes for every zone included in the AtmosphereZones folder at the time. By running the code in Roblox Studio's command bar, it looks through the first layer of the AtmosphereZones folder, checks if it has the necessary Attributes (which are identical in Name and Type to each of the main properties of the Atmosphere object), and if it doesn't, it creates those Attributes for you. This option is preferred if you have a lot of zones since it saves a ton of time and limits the amount of mistakes that could be made had it been created manually, one by one. If you're interested in a full explanation of how the code works (which also explains some of the same things I've talked about in this comment in a more visual way), I created a separate video focusing on that and included it in the "Resources" section of the description (and here's a link to the video for your convenience: th-cam.com/video/a9YVpLZUh5w/w-d-xo.html ). The second way (shown from 6:22 to 6:43 in the video) is the manual way of creating Attributes, one at a time, corresponding with each property of the Atmosphere object you want to change when players enter the zone. If someone does not want to use the code I wrote to automatically add Attributes to each of the zones, then this would be the option to follow along with. From 6:37 to 6:44, I explain what the Name of each Attribute is supposed to be and what to select for the Attribute's Type (e.g. Number and Color3 values) to ensure that it aligns with the Name and Type for each of the Atmosphere object's main properties. At 6:44 in the video, I explain how to remove Attributes from a zone if you don't want certain properties to be updated when players enter the zone (so it won't update every property all at once, just the ones you choose). After that, from 6:56 to 7:15 I explain that the values of each of the Attributes will determine what the Atmosphere will look like when the player enters that zone (and I explain how to preview what the Atmosphere will look like when the player enters that zone). Starting at 7:16, we begin to write the code that will allow the Custom Atmosphere Zones to have functionality (so that the Atmosphere will change when players enter each zone). For the code to work as intended, we're making use of the ZonePlus module (which I explain what that is, why we need it, how to add it into the game, and where it needs to be placed in the game from 3:31 to 4:15 in the video). Since I already explained in the video from 7:28 to 12:32 what each section of the code in the LocalScript does and what could be customized to fit your needs, please let me know what specifically about this last section of the video confused you so that I can provide a more robust explanation that'll make it easier to understand. If you have any additional questions about anything in this comment or in the video, please let me know and I'll try to help out some more!
how can i make this change the skybox too? (i saw you answered to another comment with this same question and can you please send the script that you sent to him but merged with the original script? i mean the full script, thanks)
Here's the full LocalScript code after making those changes (but take note that in order for it to work, you would also need to make changes to the AtmosphereZones folder, including adding the desired zone-specific skyboxes into folder that was created for that specific zone, as described in that post. For ease of access, I'll include the explanation for that here, right before the full code): "There's a few things that would need to be updated for skyboxes to be integrated into the system, starting with finding a way to define what skybox will be used for each zone. The simplest way of achieving this would likely start with adding the Sky object directly into the zone within the "AtmosphereZones" folder. Additionally, make sure that a copy of the original skybox (the one that should be visible when the player is not in any custom zones) is kept in a spot that is easy for the LocalScript to reference so that the LocalScript will be able to change it back when the player exits a custom zone. For this example, I'll keep it directly in the ReplicatedStorage and it'll be called "OriginalSkybox"." --- local ReplicatedStorage = game:GetService("ReplicatedStorage") local Lighting = game:GetService("Lighting") local TweenService = game:GetService("TweenService") local Zone = require(ReplicatedStorage.Zone) if not Lighting:FindFirstChildOfClass("Atmosphere") then warn("There wasn't an Atmosphere object in the Lighting! Creating a new one...") local newAtmosphere = Instance.new("Atmosphere") newAtmosphere.Name = "Atmosphere" newAtmosphere.Parent = Lighting end local Atmosphere = Lighting.Atmosphere local atmosphereZones = workspace.AtmosphereZones local defaultAtmosphere = { Density = Atmosphere.Density, Offset = Atmosphere.Offset, Color = Atmosphere.Color, Decay = Atmosphere.Decay, Glare = Atmosphere.Glare, Haze = Atmosphere.Haze } --- local function UpdateSkybox(newSkybox) local currentSkybox = Lighting:FindFirstChildOfClass("Sky") -- Updated to use ":FindFirstChildOfClass()" so that it will find the skybox, regardless of what it was renamed to
for propertyName, newValue in skyboxProperties do currentSkybox[propertyName] = newValue end end local function CreateZone(container) local customZone = Zone.new(container) customZone:bindToGroup("EnterOnlyOneZoneAtATime")
customZone.localPlayerEntered:Connect(function() local skyboxCheck = container:FindFirstChildOfClass("Sky") if skyboxCheck then UpdateSkybox(skyboxCheck) end
local transition = TweenService:Create(Atmosphere, TweenInfo.new(1), container:GetAttributes()) transition:Play() end)
customZone.localPlayerExited:Connect(function() local ReplicatedStorage = game:GetService("ReplicatedStorage") local originalSkybox = ReplicatedStorage.OriginalSkybox -- This and the line of code above could be added to the top of the LocalScript if you'd like
UpdateSkybox(originalSkybox)
local transition = TweenService:Create(Atmosphere, TweenInfo.new(1), defaultAtmosphere) transition:Play() end)
local connection
local function DestroyZone() customZone:unbindFromGroup("EnterOnlyOneZoneAtATime") customZone:destroy()
connection:Disconnect() connection = nil end
connection = container.AncestryChanged:Connect(function() if container.Parent ~= atmosphereZones then DestroyZone() end end)
container.Destroying:Connect(DestroyZone) end for _, container in ipairs(atmosphereZones:GetChildren()) do CreateZone(container) end atmosphereZones.ChildAdded:Connect(CreateZone)
Oh yeah I have a question. How would I add to this zone code to also modify all the properties under the "Lighting" tab (like ColorShift_Top, Ambient, ClockTime, etc)? Thanks for the help if you see this!
That would be possible to implement but you'd also need to add more TweenService-related code to the functions activated by the "localPlayerEntered" & "localPlayerExited" events (at around 10:23 in the video). Here's an example of how that can be achieved for something like changing the ClockTime: local updateTime = TweenService:Create(Lighting, TweenInfo.new(1), {ClockTime = 20}) updateTime:Play() If you wanted the ClockTime to be updated differently for every single zone you enter, further changes would need to be made to the code, specifically to the way the Atmosphere transition retrieves all the Atmosphere-related Attributes, since adding any Attributes to a zone that correspond with properties of other objects that are not the Atmosphere object would not work with the current set up. It wouldn't work right away because we call "container:GetAttributes()" for the Atmosphere transition (which gets all of the Attributes of a zone) meaning it would error if it is told to update a property that the Atmosphere object doesn't have. It may be possible to somewhat easily make this scalable by structuring it in a similar way to how I've revised the code for other developers who posted questions in this comments section regarding how to update other Lighting-related objects (such as ColorCorrection and DepthOfField) but with the ValueBase objects to represent the given properties of the Lighting service (such as Color3Value for the ColorShift / Ambient, NumberValue for ClockTime, etc.) Unfortunately, I didn't talk much about updating properties of the Lighting Service via a script in this video since the tutorial is based around the Atmosphere object and not Lighting in general. Maybe I'll create another tutorial in the future that explains how to efficiently achieve the same effect but with as many properties of the Lighting Service & other relevant Lighting Objects. In the meantime, let me know if you have any further questions about the suggestions I made above. The revised code for Lighting-related objects I mentioned can be found in very recent comments (the one from a week ago right before your comments is the one where I explained how to change the DepthOfField) so I'd recommend referencing that if you're curious about how that was implemented to see how it may be able to be applied to the Lighting service properties.
@@Emancyphur ok I actually managed to get it to mostly work! Here's the code (centered around the new parts added): local defaultAtmosphere = { Density = Atmosphere.Density, Offset = Atmosphere.Offset, Color = Atmosphere.Color, Decay = Atmosphere.Decay, Glare = Atmosphere.Glare, Haze = Atmosphere.Haze, } local function UpdateRays(newRays) local currentRays = Lighting:FindFirstChildOfClass("SunRaysEffect")
local SunRaysProperties ={ Intensity = newRays.Intensity, Spread = newRays.Spread }
local RaysTransition = TweenService:Create(currentRays, TweenInfo.new(1), SunRaysProperties) RaysTransition:Play() end local function UpdateScorch(newScorch) local CurrentTime = Lighting.ClockTime local CurrentColorTop = Lighting.ColorShift_Top
local updateTime = TweenService:Create(Lighting, TweenInfo.new(1), {ClockTime = 6.2}) local updateColor = TweenService:Create(Lighting, TweenInfo.new(1), {ColorShift_Top = Color3.fromRGB(255,87,20)}) updateTime:Play() updateColor:Play() end local function CreateZone(container) local customZone = Zone.new(container) customZone:bindToGroup("EnterOnlyOneZoneAtATime") customZone.localPlayerEntered:Connect(function() local SunRaysCheck = container:FindFirstChildOfClass("SunRaysEffect") if SunRaysCheck then UpdateRays(SunRaysCheck) end
local ScorchCheck = container:FindFirstChild("ScorchNote") if ScorchCheck then UpdateScorch(ScorchCheck) end
local transition = TweenService:Create(Atmosphere, TweenInfo.new(1), container:GetAttributes()) transition:Play() end) customZone.localPlayerExited:Connect(function() local ReplicatedStorage = game:GetService("ReplicatedStorage") local OriginalRays = ReplicatedStorage.OriginalRays
UpdateRays(OriginalRays)
local transition = TweenService:Create(Atmosphere, TweenInfo.new(1), defaultAtmosphere) transition:Play() end) -------------------------------- The UpdateRays function updates the rays based on if there's a SunRaysEffect in the zone, similar to your Depth of Field effect in an earlier comment. The UpdateScorch function updates values in an area I'm making (called the Scorchlands), so far I only have ClockTime and ColorShift_Top but I can scale this to all of them I think. For the ScorchCheck in the CreateZone function, I'm just using a blank script with the name "ScorchNote" in the Scorchland zone to notify the checker to update the values. I haven't set the exiting code yet but it works when entering the zone! I know this probably isn't the most efficient way of doing it but I'm more of a builder than a scripter so just making do with what I can figure out :/ Should at least help others with similar plans.
where's the best place to get support on this? i have a folder of smaller areas inside a larger area and sometimes it correctly identifies the smaller areas and sometimes it doesn't. i'm assuming it fails when things are loading in random order on the client
Just to have some additional context beforehand, are you intending for both the larger area and smaller areas to have custom atmosphere zones, or just the smaller areas? Along with that, toward the beginning of the Script, which folder out of the two you mentioned is referenced for the "AtmosphereZones" variable? If it's the folder with the smaller areas, then the code should be able to account for areas in that folder that happen to be streamed in to the client after the code first ran because it also runs the "CreateZone" function when the ChildAdded event fires for the AtmosphereZones folder. Consider adding a print statement at the beginning of the "CreateZone" function, such as "print(container.Name)" so that you can check in the Output which objects it's creating a zone for each time you start a playtest.
@@Emancyphur i had one giant single part as a city block, and a folder with three smaller parts meant to be the alley. i thought i read somewhere that it would support this, and assumed was a bug since sometimes when i ran it, some of the smaller parts were detected and sometimes not. with the video being so old i figured i was on my own, so i did the obvious and just spit the big part up into multiple ones so there was no more overlapping. but if there is a better fix i am interested for other parts of my city!
@@furroy While there doesn't seem to be a built-in feature for that at the moment, someone recently posted a custom solution for that situation on the Developer Forum thread for the ZonePlus Module. I personally haven't tested it out myself yet but it seems like it would work well for the use case you described. Here's the post, for reference: devforum.roblox.com/t/1017701/730
For some reason, whenever I try to change the value of atmosphere density via a .touched function (localscript, with debounce) it doesn't work. I put a print script inside and it worked so the .touched function isn't the problem. ANy advice?
Are there any errors appearing in the Output from the script? If you'd like to, you could paste the relevant parts of the LocalScript as a comment here so I could review it to see if I notice anything that might be preventing it from working properly
@@Emancyphur Oh, it turns out that the function i was using didn't actually detect if the hitPart (thing that touched the trigger) was a human or not, I fixed it by using more if statements. Thank you for trying to help though, your videos are awesome. Much love 😃
That would be possible but you'd also need to add more TweenService-related code to the functions activated by the "localPlayerEntered" & "localPlayerExited" events (at around 10:23 in the video). An example of that is the following: local updateTime = TweenService:Create(Lighting, TweenInfo.new(1), {ClockTime = 20}) updateTime:Play() If you wanted the ClockTime to be updated differently for every single zone you enter, further changes would need to be made to the code, specifically to the way the Atmosphere transition retrieves all the Atmosphere-related Attributes, since adding any Attributes to a zone that correspond with properties of other objects that are not the Atmosphere object would not work with the current set up because we call "container:GetAttributes()" for the Atmosphere transition (which gets all of the Attributes of a zone) meaning it would error if it is told to update a property that the Atmosphere object doesn't have.
I know I commented not that long ago but i need a bit more help. I tried looking on the devforum and found stuff related but nothing that solved my question. My quesiton: Is there a way to use string.find and string.lower together? My script: local String = "hello" game.Players.PlayerAdded:Connect(function(plr) plr.Chatted:Connect(function(msg) if string.find(msg, string.lower(String)) then print(plr.Name.." Said hello!") end end) end) and it works good and all, but not if I use capitals. Is there any way to make this work?
Sorry for the late response; your message was automatically held for review so I didn't see it until now. The example you posted is very close to the solution already! If you add string.lower() to the "msg" variable within the string.find() function, that will convert any uppercase letters within the player's message to lowercase. That way, so long as the player sends the correct message (regardless of capitalization), it'll meet the conditional statement. Here's what that might look like: if string.find(string.lower(msg), string.lower(String)) then -- If you want to make it look cleaner, then here's another option local lowercaseMessage = string.lower(msg) local lowercaseString = string.lower(String) if string.find(lowercaseMessage, lowercaseString) then
@@Emancyphur Thanks, andI have one more question. I want to monetize my game more but it will be hard since i have very little playerbase, so i want to give out rewards for referring friends. What im thinking is if someone is in a game with their friend they get some sort of boost, not sure what because i dont know how to make datastores. When i learn how to do this i want to do a simple thing like Play for 1 minute -> Get coins Play with a friend -> Get coins In group -> Get coins Spend coins -> Permanently get items that used to be robux only so maybe for every 100 robux its about 2500 coins and you get around: 20 coins/minute 30 coins/minute if you're playing with a friend 30 coins/minute if you're in a group 40 coins/minute if you're playing with friend and in a group I only need to know how to do if you're playing with a friend because i already know all the others. I think this will help the game get more mainstream and get me more robux which will help pay for badges and stuff to make the user play more. Sorry for the insanely long question, lol
if i want to make everyone see the same atmosphere at the same time, do i need to make a script for that or can i just update it in properties i didnt really understand
If everyone should see the updated Atmosphere at the same time no matter where they are in the game, then yes, you would just update the Atmosphere object in the Lighting service. If you need it to be updated at any point while the game is running, you can change it from a Server script and the new Atmosphere will be seen by all players in the game. There are some examples at 2:38 in the video that showcase how you can use Scripts to change the Atmosphere mid-game.
On its own, yes, those Lighting effects would work with the Atmosphere object. However, if you want those objects to be updated when entering / exiting the custom Atmosphere zones, that would be possible, but you'd also need to add more TweenService-related code to the functions activated by the "localPlayerEntered" & "localPlayerExited" events (at around 10:23 in the video). Here's an example of how that can be achieved for something like changing the Bloom: local updateBloom = TweenService:Create(Lighting, TweenInfo.new(5), {Intensity = 1, Size = 50, Threshold = 0.8}) updateBloom:Play() If you wanted the Bloom or any other additional Lighting effects to be updated differently for every single zone you enter, further changes would need to be made to the code, specifically to the way the Atmosphere transition retrieves all the Atmosphere-related Attributes, since adding any Attributes to a zone that correspond with properties of other objects that are not the Atmosphere object would not work with the current set up. It wouldn't work right away because we call "container:GetAttributes()" for the Atmosphere transition (which gets all of the Attributes of a zone) meaning it would error if it is told to update a property that the Atmosphere object doesn't have. Unfortunately, I didn't talk much about updating properties of the Lighting Service / other Lighting objects via a script in this video since the tutorial is based around the Atmosphere object and not Lighting in general. Maybe I'll create another tutorial in the future that explains how to achieve the same effect but with as many properties of the Lighting Service & other relevant Lighting Objects.
@@Emancyphur funny enough thats exactly what i did,i even added audio with it! So its a 2 in one lighting zones and audio zones,it works absolutely flawless,also yeah that would be a great idea for a tutorial,thanks for the info!
If you are referring to the Instructions provided within the Atmosphere Resources model (and to be specific, the section that talks about how to automatically add Attributes to each of the custom zones), I clearly outlined where to find the code that is meant to be copy and pasted into the command bar (which is the code within the LocalScript called "Attributes Command Bar Code". The LocalScript can be found in the "Adding Attributes Code" folder that's part of the provided resources in the Atmosphere Resources model). For reference, here are the instructions: Automatic Option: a1. Open the "Adding Attributes Code" folder. a2. Open the "Attributes Command Bar Code" LocalScript. a3. Copy and paste the code from the LocalScript into Roblox Studio's Command Bar at the bottom of the screen (this can be enabled through the "View" tab at the top left of the screen) a4. Press "Enter" on the keyboard to run the code in the command bar. The "Output" should indicate how many remaining Attributes were added to each of the items a5. After that, every item on the first layer of the "AtmosphereZones" folder will have Attributes / custom properties If you can't find it, here is the code that is meant to be copy and pasted that is being talked about in the instructions: -- This is an optional resource for adding Attributes to the custom zones -- Instructions for this can be found in the "Instructions" LocalScript within the "Custom Atmosphere Zones" folder local function CreateAttributes() local atmosphereAttributes = { Density = 0, Offset = 0, Color = Color3.fromRGB(255,255,255), Decay = Color3.fromRGB(255,255,255), Glare = 0, Haze = 0 } for _, container in pairs(workspace.AtmosphereZones:GetChildren()) do
local totalAttributesAdded = 0
for attributeName, defaultValue in pairs(atmosphereAttributes) do
if not container:GetAttribute(attributeName) then totalAttributesAdded += 1 container:SetAttribute(attributeName, defaultValue) end end
warn("Successfully added "..totalAttributesAdded.." Attributes for "..container.Name) end end CreateAttributes()
If you only want Fog, then you don't need to use Atmosphere for that, as there are "FogStart" "FogEnd" and "FogColor" properties of the Lighting service for that which work so long as there isn't an Atmosphere object in the Lighting. Roblox Creator Hub API Documentation resources: FogStart: create.roblox.com/docs/reference/engine/classes/Lighting#FogStart FogEnd: create.roblox.com/docs/reference/engine/classes/Lighting#FogEnd FogColor: create.roblox.com/docs/reference/engine/classes/Lighting#FogColor
The "CanQuery" property will only appear in the Properties window for a part if "CanCollide" is turned off. If "CanCollide" is turned on, "CanQuery" should already be enabled by default.
@@Emancyphur ay thanks a lot man I found it eventually but I really appreciate the help. This video was super well made and helpful. Well worthy of liking and subscribing
I keep getting Attempted to call require with invalid argument(s), for client LocalScript:5 which is line 5 something is wrong with the required argument, I also renamed and swapped the folder with the folder Zone so it would work removing the previous error of "folder named zone needed" (something like that) and it still wont fix, also it says container is a "Unknown global" what do I do??
Make sure you've added the "Zone" ModuleScript into the "ReplicatedStorage" service like we did at 3:52 in the video (which is from the "ZonePlus" model showcased at 3:39 in the video: www.roblox.com/library/6245329519/ZonePlus ). If you already added it there, please paste what was written for line 5 of the LocalScript -- it should match up with what was shown at 7:39 in the video. As far as the folder goes, there should be a folder directly in the Workspace called "AtmosphereZones" (with that specific spelling and capitalization). That's the folder that will store all of the custom zones so the LocalScript can easily find it
@@Emancyphur I did all of your steps in the video, I even typed it all out myself while watching ur video, everytime I get an error its the same "Attempted to call require with invalid argument(s)" stack begins the script players local script LINE 5, stack immediately ends, so I don't know what to fix, this type of error I looked up and its a problem with the require (specifically the argument in line 5) do you know of any solution? Also I tried adding a folder named Zone and playing the module script under it, to fix the error of "zone container must have a folder, model, table.... to work" which fixed that, but then the final boss comes in and its an invalid argument.
Do you mean you only want to change the "Haze" property of the Atmosphere when entering one of the custom zones, or is your question completely separate from the custom zones? And could you clarify what you mean by wanting to change it along with using the "wait(?)" command? Do you mean you want it to wait a certain amount of time before changing, to repeat between different values after waiting a certain amount of time, to have a smooth transition from one value to another that takes a certain amount of time, etc.? I'm not super sure what exactly you want to achieve, so I would appreciate it if you explain it a bit more so that I can try to explain a possible solution
@@Emancyphur completely seperate to the custom zones, i want to change the background haze colour after a certain time has passed but everything ive tried hasnt worked.
@@sig_enthusiast Oh, in that case, it would be more similar to the examples I showed from 2:38 to 3:25 in the video. Here are some examples of how you could achieve that: --- Example 1 local Lighting = game:GetService("Lighting") local Atmosphere = Lighting.Atmosphere local function updateAtmosphere() task.wait(5) print("5 seconds has passed! Updating the Atmosphere's 'Haze' property to a new Color3 value.") Atmosphere.Haze = Color3.new(0, 0, 0) -- Update it to the new Color3 value you want end updateAtmosphere() -- Calls the function with the name "updateAtmosphere" so the script knows it needs to run the code inside that function --- However, in that example, the function will only run once, at the same time the game starts up. If you want it to update the Atmosphere at different points in time, the function would need to be called again. For example, if you wanted to update it whenever a certain ClockTime has been reached in-game (so it changes depending on if it's the morning, afternoon, night time, etc.) then that would need to make use of events so that the script is listening for it to reach specific time(s) of day: --- Example 2 local Lighting = game:GetService("Lighting") local Atmosphere = Lighting.Atmosphere local function updateAtmosphere(newColor3Value) task.wait(5) print("5 seconds has passed! Updating the Atmosphere's 'Haze' property to a new Color3 value.") Atmosphere.Haze = newColor3Value -- Update it to the new Color3 value you want end local nightTimeAtmosphereColor = Color3.new(0, 0, 0) local fullDayAtmosphereColor = Color3.new(1, 1, 1) Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function() local currentClockTime = Lighting.currentClockTime local currentAtmosphereHazeColor = Atmosphere.Haze if currentClockTime >= 20 and not (currentAtmosphereHazeColor == nightTimeAtmosphereColor) then updateAtmosphere(nightTimeAtmosphereColor) elseif currentClockTime >= 5 and currentClockTime < 20 and not (currentAtmosphereHazeColor == fullDayAtmosphereColor) then updateAtmosphere(fullDayAtmosphereColor) end end) --- I can explain more about how the code works if either of these examples matches what you are trying to achieve. If I didn't answer your question or if you have additional questions, feel free to let me know and I'll try to answer! Additional Resources: Documentation for the "ClockTime" property of the Lighting Service (Roblox Creator Documentation site): create.roblox.com/docs/reference/engine/classes/Lighting#ClockTime Documentation for the ":GetPropertyChangedSignal()" method (Roblox Creator Documentation site): create.roblox.com/docs/reference/engine/classes/Instance#GetPropertyChangedSignal
Oh my, I was never notified of this comment; sorry about taking such a long time to reply! Would you still like help with creating that, or not anymore? If you do, then I have some follow-up questions about the specifics of how that would work: 1. If the player activates the ProximityPrompt inside of the zone and then leaves the zone, would you want the Atmosphere to change back to the default settings? If so, when the player walks back into the zone, would you want it to automatically swap to the custom Atmosphere properties of that zone or would the player need to re-activate the ProximityPrompt every single time they enter that zone for the Atmosphere to change again? 2. If the player activates the ProximityPrompt inside of a custom zone, waits a moment, and then activates it again, would you want that to deactivate the custom properties (e.g. making it go back to the default Atmosphere) or for it to not change anything? 3. Do you want it to function that way for every single Atmosphere zone, or just specific ones? And if the specifics of what you wanted to create have changed since you posted the comment 2 months ago, feel free to let me know so that I make sure any code samples I provide will match what you are looking for now
@@Emancyphur 1. yes i would, the player has to re-activate the proximity prompt every time. 2. i dont want the player to deactivate the custom properties, i want the properties to deactivate automatically after a certain amount of time. 3. i want it to function that way for only specific atmosphere zones. the specifics of what i wanted to create remains the same since i posted the comments. once again, thank you for reaching out.
@@neosigma4 I'm happy to hear that this'll allow you to continue developing your game (but also I apologize again because that is 2 months where I could have responded to help much sooner!) Thanks for clarifying further; I'll try to respond again soon-ish with a completed example but as a heads-up, I have a fairly busy schedule this weekend and I am not feeling 100% at the moment so it may be a couple more days before I get back with a working example.
@@neosigma4 Oh one more question; you mentioned in your answer to the second question that you want the properties to automatically deactivate after a certain amount of time. What would the requirements for this be (e.g. does the timer start from the moment that the player activates the ProximityPrompt? Or does it start the moment they exit the custom zone?)
That would be possible but you'd also need to add more TweenService-related code to the functions activated by the "localPlayerEntered" & "localPlayerExited" events (at around 10:23 in the video). An example of that is the following: local updateTime = TweenService:Create(Lighting, TweenInfo.new(1), {ClockTime = 20}) updateTime:Play() If you wanted the ClockTime to be updated differently for every single zone you enter, further changes would need to be made to the code, specifically to the way the Atmosphere transition retrieves all the Atmosphere-related Attributes, since adding any Attributes to a zone that correspond with properties of other objects that are not the Atmosphere object would not work with the current set up because we call "container:GetAttributes()" for the Atmosphere transition (which gets all of the Attributes of a zone) meaning it would error if it is told to update a property that the Atmosphere object doesn't have. --- If I remember correctly, the creator of the ZonePlus module has an open-sourced example place that includes an example of changing the time of day through the custom zones: www.roblox.com/games/6166477769/ZonePlus-Playground
I have a small question, I'm curious on if it's possible to have it also change the Color correction of certain zones, if so, I'd really like to know how.
That would be possible, but you'd also need to add more TweenService-related code to the functions activated by the "localPlayerEntered" & "localPlayerExited" events (at around 10:23 in the video). There's a few things that would need to be updated for that to be integrated into the system, starting with finding a way to define what the new ColorCorrectionEffect values would be for each zone. The simplest way of achieving this with making minimal changes to the system would start with adding a customized ColorCorrectionEffect object directly into the zone within the "AtmosphereZones" folder. Additionally, make sure that a copy of the original ColorCorrectionEffect (the one that should be visible when the player is not in any custom zones) is kept in a spot that is easy for the LocalScript to reference so that the LocalScript will be able to change it back when the player exits a custom zone. For this example, I'll keep it directly in the ReplicatedStorage and it'll be called "OriginalColorCorrectionEffect". Next, the sections of code that would need to be updated in the LocalScript are above and within the functions activated from the "localPlayerEntered" & "localPlayerExited" events (pause the video at around 10:55 to see where this new code would go in relation to the existing code). The main purpose of the changes will be to check if the custom zone that the player has entered has a ColorCorrectionEffect, and if so, we'll loop through all of its properties and then replace the current ColorCorrectionEffect's properties with the brand new one. If you need any additional clarification about how the code works, feel free to ask! Here's what the brand new code would look like (starting from right before the "CreateZone" function all the way until the point where the changes to the code end): --- local function UpdateColorCorrection(newColorCorrectionEffect) local currentColorCorrectionEffect = Lighting:FindFirstChildOfClass("ColorCorrectionEffect") -- Fixed error; originally looked for an object named "ColorCorrectionEffect" but that is not the default name of the object. Switched it to look for the object based on ClassName so it works regardless of whether or not it was renamed.
local ColorCorrectionEffectProperties = { Brightness = newColorCorrectionEffect.Brightness, Contrast = newColorCorrectionEffect.Contrast, Saturation = newColorCorrectionEffect.Saturation, TintColor = newColorCorrectionEffect.TintColor } local ColorCorrectionEffectTransition = TweenService:Create(currentColorCorrectionEffect, TweenInfo.new(1), ColorCorrectionEffectProperties) -- Update the "TweenInfo.new(1)" with your preferred settings to customize how the values of the ColorCorrectionEffect will change (how quickly and the EasingStyle/Direction) ColorCorrectionEffectTransition:Play() end local function CreateZone(container) local customZone = Zone.new(container) customZone:bindToGroup("EnterOnlyOneZoneAtATime")
customZone.localPlayerEntered:Connect(function() local ColorCorrectionEffectCheck = container:FindFirstChildOfClass("ColorCorrectionEffect") if ColorCorrectionEffectCheck then UpdateColorCorrection(ColorCorrectionEffectCheck) end
local transition = TweenService:Create(Atmosphere, TweenInfo.new(1), container:GetAttributes()) transition:Play() end)
customZone.localPlayerExited:Connect(function() local ReplicatedStorage = game:GetService("ReplicatedStorage") local OriginalColorCorrectionEffect = ReplicatedStorage.OriginalColorCorrectionEffect -- This and the line of code above could be added to the top of the LocalScript if you'd like
local transition = TweenService:Create(Atmosphere, TweenInfo.new(1), defaultAtmosphere) transition:Play() end) --- Sorry that this wasn't included in the original tutorial; I didn't address the properties of the Lighting Service and other Lighting-related objects since this tutorial was based around the Atmosphere object and not Lighting in general. Maybe I'll create another tutorial in the future that explains how to achieve the same effect but with many of the available Lighting effects, but for now, I hope this comment was useful! If you have any additional questions, feel free to ask.
@@Emancyphur You sir, are a godsend, thank you a ton! I'll definitely be looking forward to any future videos you may do, have a good rest of your day.
@@Emancyphur Hello, me again. I've come back to this video to try this out; and it seems to not work, although I followed the instructions perfectly, so I'm not exactly sure on where I went wrong with this. This is probably a lot to ask, but would you so mind to make a video showing this process so I can accurately pinpoint what exactly I did wrong. (Or, like you said before, a tutorial regarding other lighting effects plus this one. I think you'd be the first and only creator on YT that actually shows how this is done, as I've never seen any other video alike to this.) Thank you regardless however for even creating this.
@@cheeseman1860 I'll take another look at it to see if I made a mistake and if I figure out something that works I'll provide a full example here (the entire LocalScript code)
@@cheeseman1860 Oh I found out what was causing the issue; when adding the effect into the Lighting service, it is named "ColorCorrection", but its ClassName property is "ColorCorrectionEffect". However, the first line of revised code I wrote within the "UpdateColorCorrection" function errors because it's trying to look for an object with the name of "ColorCorrectionEffect". Unless you specifically renamed the effect in the Lighting service to have the word "Effect" added to the end of it, it'll stop the code from running at that point. After changing that line of code to look for "ColorCorrection" in the Lighting service, it appeared to work as intended. I'll be sure to update my original reply above to include this change so that it'll work right away for anyone else who would like to add that functionality to the custom zones. Hope that this helps :D Edit: After second thought, I'll be updating that line of code to look for the object by its ClassName, instead of its Name, so that it'll be able to find the object either way
Hi, I'm getting this error when I run the code, any idea on how to fix it or what I did wrong? Output Error: Getchildren is not a valid member of Folder "Workspace.AtmosphereZones"
The letter "c" needs to be capitalized since it's case-specific, meaning the code would go from atmosphereZones:Getchildren() to atmosphereZones:GetChildren()
Can u make ah tutorial how to make an tool and when u click the tool ah accessory equipped and if u click again the tool the accessory is unequipped and the accessory gives u life like blox fruits or gpo please is an emergency with my game :(
Although I don't have a combined tutorial for that, I already created two separate tutorials for those features which should be able to work together to achieve the effect that you described (one for clicking on an item to equip it and another for a holstering system that allows an Accessory version of a Tool to appear on a player's Character when the Tool has been unequipped): Click to Equip Hat, Clothing, & Tools Tutorial: [ th-cam.com/video/eWmmZdBM8MY/w-d-xo.html ] Holstering System Tutorial: [ th-cam.com/video/7_My5xBzQZ4/w-d-xo.html ]
@@Jack0oxPG3D As I mentioned in my original reply, what you described is possible by combining two existing tutorials that I've published to my channel. One of the tutorials explains how to allow players to click on items to equip it / add it to their in-game Backpack, and the other tutorial explains how to make the Tool appear as an Accessory when the player unequips the Tool. If you have any additional questions, feel free to ask!
You can add Attributes to one of the Custom Zones in two different ways, which can be summed up with the following: Manual Option (explained from 6:22 to 7:02) 1. Select the zone in the AtmosphereZones folder 2. Look at the "Properties" window (that can be enabled through the "View" tab at the top left of the screen) 3. Scroll down until you see the "Attributes" section 4. Press "Add Attribute", then create Attributes that have the exact same name as the properties of the Atmosphere you want to change (note: the "Type" that you choose for each Attribute is shown at 6:38 in the video) Automatic Option (explained from 6:02 to 6:21 and if you want to know how the code works, I explain that here: th-cam.com/video/a9YVpLZUh5w/w-d-xo.html ): 1. Open the "Adding Attributes Code" folder from the Atmosphere Resources model. 2. Open the "Attributes Command Bar Code" LocalScript. 3. Copy and paste the code from the LocalScript into Roblox Studio's Command Bar at the bottom of the screen (this can be enabled through the "View" tab at the top left of the screen). You don't need to know how to code in order to do this, as the code that creates the Attributes for each zone should not need to be updated (since this just creates the Attributes and you can customize it manually for each zone through the "Properties" window) (For your convenience, here is what is contained within that LocalScript:) --- -- This is an optional resource for adding Attributes to the custom zones -- Instructions for this can be found in the "Instructions" LocalScript within the "Custom Atmosphere Zones" folder local function CreateAttributes() local atmosphereAttributes = { Density = 0, Offset = 0, Color = Color3.fromRGB(255,255,255), Decay = Color3.fromRGB(255,255,255), Glare = 0, Haze = 0 } for _, container in pairs(workspace.AtmosphereZones:GetChildren()) do
local totalAttributesAdded = 0
for attributeName, defaultValue in pairs(atmosphereAttributes) do
if not container:GetAttribute(attributeName) then totalAttributesAdded += 1 container:SetAttribute(attributeName, defaultValue) end end
warn("Successfully added "..totalAttributesAdded.." Attributes for "..container.Name) end end CreateAttributes() --- 4. Press "Enter" on the keyboard to run the code in the command bar. The "Output" should indicate how many remaining Attributes were added to each of the items 5. After that, every item on the first layer of the "AtmosphereZones" folder will have Attributes / custom properties --- If you have any additional questions, feel free to ask!
I've briefly looked into the Dynamic Skies / Dynamic Clouds feature but because the feature has not been fully developed to what Roblox Staff had outlined on the feature's announcement / update thread (as of November 22nd, 2022), I haven't considered creating a tutorial about it yet because the feature would probably be subject to further updates. Once it reaches Phase 3 of the roadmap (or once they announce that the feature is fully released) that's when I'd begin to consider creating a video about it. Feature Announcement / Update Thread: devforum.roblox.com/t/869476
Well you're in luck because I plan on livestreaming this upcoming weekend! It has been a super long time since the last stream (probably around a year) so it will be interesting to see how many people I still recognize from the streams before
It should still work on mobile; for reference, what was your in-game graphics quality set to, and did you notice it not working in your own game or a game created by another developer?
That would be possible by adding more TweenService-related code to the functions activated by the "localPlayerEntered" & "localPlayerExited" events (at around 10:23 in the video). An example of that is the following: local updateTime = TweenService:Create(Lighting, TweenInfo.new(1), {ClockTime = 20}) updateTime:Play() If you wanted the ClockTime to be updated differently for every single zone you enter, further changes would need to be made to the code, specifically to the way the Atmosphere transition retrieves all the Atmosphere-related Attributes, since adding any Attributes to a zone that correspond with properties of other objects that are not the Atmosphere object would not work with the current set up because we call "container:GetAttributes()" for the Atmosphere transition (which gets all of the Attributes of a zone) meaning it would error if it is told to update a property that the Atmosphere object doesn't have.
Please you can help me I go to make team create I go to permission he call me [Manage collaborator by clicking on the blue button in the top right corner of studio]
If your question is about how to enable Team Create and invite a player to edit a game, I explained that in another tutorial: [ th-cam.com/video/vsHJH2bFn0Q/w-d-xo.html ]. If that doesn't answer your question, please explain your question more clearly so that it is easier to understand what you need help with.
That would be possible but you'd also need to add more TweenService-related code to the functions activated by the "localPlayerEntered" & "localPlayerExited" events (at around 10:23 in the video). Here's an example of how that can be achieved for something like changing the ClockTime: local updateTime = TweenService:Create(Lighting, TweenInfo.new(1), {ClockTime = 20}) updateTime:Play() If you wanted the ClockTime to be updated differently for every single zone you enter, further changes would need to be made to the code, specifically to the way the Atmosphere transition retrieves all the Atmosphere-related Attributes, since adding any Attributes to a zone that correspond with properties of other objects that are not the Atmosphere object would not work with the current set up. It wouldn't work right away because we call "container:GetAttributes()" for the Atmosphere transition (which gets all of the Attributes of a zone) meaning it would error if it is told to update a property that the Atmosphere object doesn't have. Unfortunately, I didn't talk much about updating properties of the Lighting Service via a script in this video since the tutorial is based around the Atmosphere object and not Lighting in general. Maybe I'll create another tutorial in the future that explains how to achieve the same effect but with as many properties of the Lighting Service & other relevant Lighting Objects.
Do you have a question about why the Atmosphere's color isn't being updated when you set it to Red? Remember that both the "Color" and "Decay" properties change how the Atmosphere appear, so you might need to change both of the properties to make it look how you want.
Are you referring to the Custom Atmosphere Zones not working at all, or something else from the video? As far as I'm aware, nothing has changed with how it works since the video's release. Please check the Output (which can be enabled through the "View" tab at the top left of the screen) to see if there are any errors appearing from the scripts that were shown in the video. I'd also recommend taking a look at the setup model in the description and comparing the custom zones provided there to see if there's any differences between that and the ones you created. I'd recommend using the custom zones provided (as well as the provided LocalScript for the StarterPlayerScripts in case there are any discrepancies between that and if you wrote it manually while watching the video) so you could modify the custom zones to the desired values to get everything working more quickly.
If you're talking about the Custom Atmosphere Zones, make sure that Part remained in the "AtmosphereZones" folder (so that the LocalScript will recognize it as a zone) and that it has its "Anchored" property enabled so it doesn't fall into the void. Also ensure that it still has the "CanQuery" property enabled so that the LocalScript will be able to check if the player is standing inside of the zone. Additionally, make sure it still has Attributes (from the process at 5:50 in the video). As long as those aspects of the zone weren't changed prior to updating the size of the part, it should still work as intended.
If you're talking about my previous TH-cam Channel names that I listed in the "About" section of my channel, those were the main channel names that I had for a few years at a time within the past decade. I started this channel in 2013 and since then, there have been times where I wanted to update the channel name to something cooler / a new name that I liked more. My current channel name of "Emancyphur" will likely be the final name I keep for this channel moving forward.
I don't have much experience with building, texturing, and how the PBR / Physically-Based Rendering feature works, so it's unlikely that I'll create a video about it. Here are some existing resources about that feature that may be useful for learning more: Surface Appearance - Roblox Creator Documentation: [ create.roblox.com/docs/building-and-visuals/external-modeling/surface-appearance ] SurfaceAppearance Announcement Topic - Roblox Developer Forum: [ devforum.roblox.com/t/663449 ]
You can change the time of day through the "TimeOfDay" property of the "Lighting" Service (briefly shown at 2:27 in the video). If your question is about changing the time of day and the Atmosphere at the same time, then that would be possible but you'd also need to add more TweenService-related code to the functions activated by the "localPlayerEntered" & "localPlayerExited" events (at around 10:23 in the video). An example of that is the following: local updateTime = TweenService:Create(Lighting, TweenInfo.new(1), {ClockTime = 20}) updateTime:Play() If you wanted the ClockTime to be updated differently for every single zone you enter, further changes would need to be made to the code, specifically to the way the Atmosphere transition retrieves all the Atmosphere-related Attributes, since adding any Attributes to a zone that correspond with properties of other objects that are not the Atmosphere object would not work with the current set up because we call "container:GetAttributes()" for the Atmosphere transition (which gets all of the Attributes of a zone) meaning it would error if it is told to update a property that the Atmosphere object doesn't have.
Hey, you probably don't remember me but if you do you'll most likely remember me as øntario (looking back that was kinda a stupid name, considering I don't live anywhere close to the ontario in canada) and I've recently got into scripting, you as one of my biggest inspirations. Is there any way since you cant give a badge locally you can make a script that gives a badge to someone if they say a certain phrase or keyword? Thanks. - mrlemflem (formerly øntario)
I remember you! If I remember correctly, you used to join the games we'd play during livestreams a few years ago. It's awesome that you are interested in learning about scripting and I'm glad that you returned! To create the feature that you described, we would need to create a server script, then check when a player sends a message through the "player.Chatted" event. We can then check if their message matches up with the keyword, and if it does, we can use the BadgeService to award a badge to the player. Here is an example (and if you have any additional questions, feel free to ask!): --- local Players = game:GetService("Players") local BadgeService = game:GetService("BadgeService") local keyword = "word or phrase the player has to say to receive the badge (preferably all lowercase)" local badgeID = 1 -- This is the Asset Id of the badge you want to award players when they say the keyword Players.PlayerAdded:Connect(function(player) player.Chatted:Connect(function(message) if string.lower(message) == keyword then BadgeService:AwardBadge(player.UserId, badgeID) end end) end) --- Additional Resources: BadgeService - Roblox Creator Documentation: create.roblox.com/docs/reference/engine/classes/BadgeService player.Chatted Event - Roblox Creator Documentation: create.roblox.com/docs/reference/engine/classes/Player#Chatted
@@Emancyphur Yes! One I vividly remember was the bloxy awards and I think one of the egg hunts (I'm not sure), and thanks for the script! ill try to tune in if I need any more help and i've learned alot in tutorials, one guy i saw a comment of said this really smart thing that was something like "Dont just rush to finish tutorials, try to learn from them." And ill certainly try to learn from this. Edit: It works! thank you so much.
@@mrlemflem Yeah the Bloxy Awards and the unofficial Egg Hunt livestreams were super fun! To answer your question, the script could be placed in the ServerScriptService. Most server scripts end up being placed there since it's one of the primary containers where the code within the script is allowed to run. Its placement in the game really depends on its purpose for the game / what it does; if it was for the functionality of a Tool, such as a skateboard or a sword, it is more likely that the server script would be placed in the Tool rather than the ServerScriptService. Additional Resources: ServerScriptService - Roblox Creator Documentation: create.roblox.com/docs/reference/engine/classes/ServerScriptService Script - Roblox Creator Documentation: create.roblox.com/docs/reference/engine/classes/Script
Are you referring to the Custom Atmosphere Zones not working at all, or something else from the video? As far as I'm aware, nothing has changed with how it works since the video's release. Please check the Output to see if there are any errors occurring related to the scripts from the video. I'd also recommend taking a look at the setup model in the description and comparing the custom zones provided there to see if there's any differences between that and the ones you created. I'd recommend using the custom zones provided (as well as the provided LocalScript for the StarterPlayerScripts in case there are any discrepancies between that and if you wrote it manually while watching the video) so you could modify the custom zones to the desired values to get everything working more quickly.
@@Emancyphur Any way yo share my place with you? Its mine and my friends and im new to scripting but good enough to know whats going on, no error message just nothing changes when i enter
@@snowee5982 If you want to, you can. If it's a group game I'd need to join the group but if it's on an individual profile, I'd just need to temporarily send a friend request and you could invite me to it (more info about that process is here: create.roblox.com/docs/projects/collaboration ). However, I could still try to help you figure out what might be happening without needing to do that. For reference, did you already try to use the pre-made custom zones model that was provided in the description (which has written instructions)?
Are you referring to the custom atmosphere zones not working or one of the example scripts from earlier in the video? If the former, the Custom Atmosphere Zones still work in the same way as it was shown in the video (if you move everything from the folders in the Atmosphere Resources into the designated spots, it should work with the provided resources right away). For the LocalScript, did you write it manually while watching the video or did you use the one provided with the model in the description? Are any errors appearing in the Output when playtesting?
@@touseey Are any errors appearing in the Output when playtesting? Here's an example video I recorded just now in a fresh Baseplate template showcasing that it still works: th-cam.com/video/K1EQYOoFDMs/w-d-xo.html
Your atmosphere resources are complicated! make a STEP by STEP im so dissapointed in myself because i cant even get what your saying since im new to studio!!
There are already step-by-step written instructions provided in the Atmosphere Resources model (to be specific, it can be found in the LocalScript called "Instructions" within the "Custom Atmosphere Zones" folder) that explains where everything needs to be placed, what objects need to be created / modified, etc. If you have any specific questions about the step-by-step process, feel free to ask since I don't know which part of the process you want help with. As of November 23rd, 2023, here are the written instructions provided with the model: 1. Open the folders called "ReplicatedStorage Items", "StarterPlayerScripts Items", and "Workspace Items" 2. Move the "Zone" ModuleScript into the "ReplicatedStorage" Service 3. Move the "LightingZone" LocalScript into the "StarterPlayerScripts" folder (which can be found through the "StarterPlayer" Service) 4. Move the "AtmosphereZones" folder into the Workspace 5. Add a "Sky" and "Atmosphere" object into the "Lighting" Service if there aren't ones there already. (Select the plus button next to the Lighting Service, then click "Sky". Follow the same process for the "Atmosphere" object) 6. Customize the properties of the Atmosphere to create your desired "default" Atmosphere, which is what the Atmosphere will look like when a player is not standing in any custom zone. 7. Use parts to create zones / regions that the player needs to walk into for the Atmosphere to be updated. (Included in the AtmosphereZones folder are a few examples of custom zones) ---- Requirements for the custom zone to work: a. A zone can be made of a single part, or multiple parts can be placed into an object that isn't a part, such as a Model or a Folder. Examples of this are included in the "AtmosphereZones" folder. b. Parts that are contained within other parts will not be included in the custom zone (see the "Blue Zone" in the AtmosphereZones folder as an example). c. The "CanCollide" property of the parts must be set to false (unchecked box). This is because by default, players must be standing inside of a part within the zone to activate the intended effects. (It is also recommended to enable the "Anchored" property and set the "Transparency" property to 1 for each part that makes up the zone so the player's view is not blocked by the parts). d. The "CanQuery" property of the parts must be set to true (checked box). Without this, the ZonePlus module will not be able to detect when a player enters or exits the part(s). ---- 8. Open the "AtmosphereZones" folder for the final steps. We need to add Attributes to each of the zones so the "LightingZone" LocalScript knows what the Atmosphere should look like when a player enters a zone ---- There are two options for adding Attributes to the zones Automatic Option: a1. Open the "Adding Attributes Code" folder. a2. Open the "Attributes Command Bar Code" LocalScript. a3. Copy and paste the code from the LocalScript into Roblox Studio's Command Bar at the bottom of the screen (this can be enabled through the "View" tab at the top left of the screen) a4. Press "Enter" on the keyboard to run the code in the command bar. The "Output" should indicate how many remaining Attributes were added to each of the items a5. After that, every item on the first layer of the "AtmosphereZones" folder will have Attributes / custom properties Manual Option: b1. Select each zone in the "AtmosphereZones" folder (Reminder: You can select multiple parts at the same time by holding the Control [Ctrl] or Command [Cmd] key and selecting each part. This allows you to apply the same Attributes to all of the selected items at once) b2. Navigate to the "Properties" widget (which can be enabled through the "View" tab at the top left of the screen) b3. Look for the "Attributes" category b4. Select "Add Attribute" b5. Set the name of the Attribute to the exact same name of one of the Atmosphere object's properties. The "type" is the type of value that the property is (examples are included below). b6. Repeat the previous step for every property of the Atmosphere object. Here is a list of the Atmosphere object's properties and the types of values: Density - number Offset - number Glare - number Haze - number Color - Color3 Decay - Color3 ---- 9. Customize the Attributes (by selecting the zone, navigating to the "Properties" widget, looking for the "Attributes" category, then selecting the box to the right of the Attribute where it shows a value of [255, 255, 255] or 0 by default) to the settings that you want the Atmosphere to have when the player enters the zone (Reminder: The example AtmosphereZones that were provided with this model already have customized Attributes as a point of reference) 10. To make it easier, customize the properties of an "Atmosphere" object in the "Lighting" Service to what you want the Atmosphere to look like 11. Then, copy the values of each property of the Atmosphere and paste it into the value of the Attribute that has the same name. 12. After that, the custom Atmosphere zones should be complete!
Are you referring to the Custom Atmosphere Zones not working at all, or something else from the video? As far as I'm aware, nothing has changed with how it works since the video's release. Please check the Output to see if there are any errors occurring related to the scripts from the video. I'd also recommend taking a look at the setup model in the description and comparing the custom zones provided there to see if there's any differences between that and the ones you created. I'd recommend using the custom zones provided (as well as the provided LocalScript for the StarterPlayerScripts in case there are any discrepancies between that and if you wrote it manually while watching the video) so you could modify the custom zones to the desired values to get everything working more quickly.
Ahhh, I'm super sorry about the really late response! I was going to go into Roblox Studio and write some example code to answer your question but I kept getting distracted by other things and eventually forgot to respond. To answer your question, it would be possible to have separate skyboxes for different zones, however, it would not be able to have a smooth transition because the type of most of the properties that the "Sky" object has are not on the list of property types that the TweenService is able to update: ( create.roblox.com/docs/reference/engine/classes/TweenService ). There's a few things that would need to be updated for skyboxes to be integrated into the system, starting with finding a way to define what skybox will be used for each zone. The simplest way of achieving this would likely start with adding the Sky object directly into the zone within the "AtmosphereZones" folder. Additionally, make sure *that a copy of the original skybox (the one that should be visible when the player is not in any custom zones) is kept in a spot that is easy for the LocalScript to reference so that the LocalScript will be able to change it back when the player exits a custom zone. For this example, I'll keep it directly in the ReplicatedStorage and it'll be called "OriginalSkybox". Next, the sections of code that would need to be updated in the LocalScript are above and within the functions activated from the "localPlayerEntered" & "localPlayerExited" events (pause the video at around 10:55 to see where this new code would go in relation to the existing code). The main purpose of the changes will be to check if the custom zone that the player has entered has a skybox, and if so, we'll loop through all of its properties and then replace the current skybox's properties with the brand new one. If you need any additional clarification about how the code works, feel free to ask! Here's what the brand new code would look like (starting from right before the "CreateZone" function all the way until the point where the changes to the code end): --- local function UpdateSkybox(newSkybox) local currentSkybox = Lighting.Sky
for propertyName, newValue in skyboxProperties do currentSkybox[propertyName] = newValue end end local function CreateZone(container) local customZone = Zone.new(container) customZone:bindToGroup("EnterOnlyOneZoneAtATime")
customZone.localPlayerEntered:Connect(function() local skyboxCheck = container:FindFirstChildOfClass("Sky") if skyboxCheck then UpdateSkybox(skyboxCheck) end
local transition = TweenService:Create(Atmosphere, TweenInfo.new(1), container:GetAttributes()) transition:Play() end)
customZone.localPlayerExited:Connect(function() local ReplicatedStorage = game:GetService("ReplicatedStorage") local originalSkybox = ReplicatedStorage.OriginalSkybox -- This and the line of code above could be added to the top of the LocalScript if you'd like
UpdateSkybox(originalSkybox)
local transition = TweenService:Create(Atmosphere, TweenInfo.new(1), defaultAtmosphere) transition:Play() end) --- Sorry that this wasn't included in the original tutorial; I didn't address Skyboxes or the properties of the Lighting Service since this tutorial was based around the Atmosphere object and not Lighting in general. Maybe I'll create another tutorial in the future that explains how to achieve the same effect but with the properties of the Lighting Service & other relevant Lighting Objects, but for now, I hope this comment was useful! If you have any additional questions, feel free to ask.
Did I make any mistakes? Do you have questions or suggestions? Post a comment to let me know! ✨ Roblox Game Development Tutorial Playlists ► www.emancyphur.com/tutorials/playlists
*Video Timestamps / Chapters*
0:00 How to add Atmosphere into your game
0:19 How to customize Atmosphere
-
0:40 How the Atmosphere’s properties work
(Sub-chapters)
0:41 How the Density and Offset Properties Work
1:15 How the Haze and Color Properties Work
1:45 How the Glare and Decay Properties Work
2:27 Other Important Lighting Properties
-
2:38 Scripting Atmosphere
3:26 Creating Atmosphere Zones / Regions
5:13 Customizing the Atmosphere Zones
7:16 Coding the Atmosphere Zones
EMANCYPHUR I DID IT HEHGGYYT I GOT ON EVERY SPEEDRUN LB AND BEAT U IN SOME GGG TYSM FOR BEING MY TEACHER (super golf)
Yo what is container meant to be bc you didnt make it a variable nor anything so am i suppose to put smthin in it or whatever? reply bck pls @Emancyphur
also im getting the error Players.GuguTDM.PlayerScripts.LocalScript:52: Expected ')' (to close '(' at line 41), got 'container' ive tried fixing it but a different error just keeps coming up.
@@L1s3rg1c If you're talking about the "container" at 9:03 in the video, that refers to the object that's sent into the function (which in that case, is every item that is added to the first layer of the "atmosphereZones" folder. For reference, one of the ways that function is activated is when the "atmosphereZones.ChildAdded" event is fired at the bottom of the LocalScript). As far as the error you've encountered, make sure you didn't forget to add any closing parentheses anywhere. For instance, at "local function CreateZone(container)", the closing parentheses is immediately after the word "container".
If that didn't answer your question(s), please explain more, including the section of code that's erroring (or the entire LocalScript to be able to more easily identify what isn't working properly) in your next reply if it's still not working as intended. Remember that the fully working and completed product from the tutorial is also available in the description (or right here, for your convenience):
1⃣ [Atmosphere Resources - Setup Model w/Source Code] create.roblox.com/marketplace/asset/10348226901
Alternatively, the source code and an optional model download can be found on this GitHub Repository ► github.com/Emancyphur/Roblox-Studio-Tutorials
@@Emancyphur the line that is giving me an error is container.Destroying:Connect(DestroyZone) in StarterPlayerScripts inside the local file thank you for acknowledging my question.
Holy crap, so underrated! Definitely going to be watching more of your stuff, thank you!
Only needed the first bit to figure out why atmosphere wasn't working, but just let it play through the rest of the tutorial. It sounds like you put a lot of work into this, and it is very well done. Thank you for sharing your knowledge!
I really appreciate the kind words! I didn't connect the dots until a few days after you posted your comment, but your channel name sounded familiar and when I searched for your profile on Roblox and checked the games you've created... I realized that I played your "Prison Tycoon" game back in 2012!!! I have several of the badges from that game that appear on Page 117 in my inventory (out of 119 pages) and because one of the Roblox browser extensions I have showcases the "Unlocked" date for earned badges, it says that I obtained most of those badges on "September 22, 2012", which was pretty much within the first month I had started playing Roblox. And then out of all the badges, I earned the "Bunny VIP Badge" along with a few others the next year on "August 4, 2013" haha.
With all of that in mind, it's so crazy cool to know that you've watched one of my tutorials, and such a random coincidence given it has been over a decade since I played one of your games. It's not very often that something like that happens -- really puts into perspective how small of a world we're living in.
It's also awesome to know that you're still creating stuff on Roblox to this day! Are you working on any new games of your own or mainly experimenting with Roblox Studio's features and creating small projects (which is pretty much what I do)?
Hey! It really must be a small world after all. It makes me so happy hearing things like this. That’s awesome to think that a decade ago you were playing my game, and now I am learning from your tutorial. Personally, I fell off since the early 2010s as far as making games, but every so often I do make a new game either by myself or with a buddy. I usually start a lot of projects, but never finish them. I also have so many games that I want to make but, sadly, I just never get to drive to do it. I’m working full time as a software engineer, so that takes up much of my time, but here and there I do have spouts of Roblox. I hope you continue your journey with making projects and tutorials, because it really seems you’re good at what you do! I appreciate you reaching out!
i usually just switch the values in lighting randomly until it looks good. this should help a lot in making it look better thank you!
Thank you so much! Replaying this video over and over again to know what to do thanks i've been searching how to change sky etc for my horror game! very underrated
I managed to Advanced the ZonePlus Module to not only do Atmospheres, but PPE (Post Processing Effects),Ssounds, LightingService Properties, Clouds, TerrainService Properties, and i plan to add more, but for now this is more than enough. I plan to Release this to the Marketplace either as a Model you can insert or a a simple and easy Plugin with Settings/Configurations, but i would need to Polish and Secure it and fix some of the bugs with it.
Any update on this? This would be a genuine godsend to have.
holy mother of mary, your channel is criminally underrated!!!!!!!
Super useful tutorial. One thing I don't think you mentioned though is that by default, these zones need to be in the default collision group. Was stuck on this one for a little until I noticed in the output that error message for it.
VERY useful tutorial, the only one that actually is a tutorial for this. Literally, roBuilder didnt even show half of the scripts in his tutorial!
Thank you so much ❤ appreciate your hard work plus for free, you deserve better visibility.
So underrated thank you so much for helping me on my game
actually needed this tbh
Thank you so much for this tutorial man it helped alot, uh and also i wondered if it was possible to change the depth of field with the atmosphere when the player enters a new zone, and how. Thank you !
It would be possible to update the Depth Of Field at the same time; this would require some changes to the LocalScript code as well as having a way of defining what the new values for each particular zone should be. I answered a similar question like this before but for the ColorCorrectionEffect, so my response here will effectively be the same as that but repurposed to work with the DepthOfField:
The simplest way of achieving this with making minimal changes to the system would start by adding a customized DepthOfField object directly into the zone within the "AtmosphereZones" folder. Additionally, make sure that a copy of the original Depth Of Field (configured with the settings that it should have when the player is not in any custom zones) is kept in a spot that is easy for the LocalScript to reference so that the LocalScript will be able to change it back when the player exits a custom zone. For this example, I'll keep it directly in the ReplicatedStorage and it'll be called "OriginalDepthOfFieldEffect".
Next, the sections of code that would need to be updated in the LocalScript are above and within the functions activated from the "localPlayerEntered" & "localPlayerExited" events. The main purpose of the changes will be to check if the custom zone that the player has entered has a DepthOfFieldEffect, and if so, we'll loop through all of its properties and then replace the current DepthOfFieldEffect's properties with the brand new one. If you need any additional clarification about how the code works, feel free to ask! Here's what the entire LocalScript code would look like after making those changes:
-- New LocalScript code
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Lighting = game:GetService("Lighting")
local TweenService = game:GetService("TweenService")
local Zone = require(ReplicatedStorage.Zone)
if not Lighting:FindFirstChildOfClass("Atmosphere") then
warn("There wasn't an Atmosphere object in the Lighting! Creating a new one...")
local newAtmosphere = Instance.new("Atmosphere")
newAtmosphere.Name = "Atmosphere"
newAtmosphere.Parent = Lighting
end
local Atmosphere = Lighting.Atmosphere
local atmosphereZones = workspace.AtmosphereZones
local defaultAtmosphere = {
Density = Atmosphere.Density,
Offset = Atmosphere.Offset,
Color = Atmosphere.Color,
Decay = Atmosphere.Decay,
Glare = Atmosphere.Glare,
Haze = Atmosphere.Haze
}
---
local function UpdateDepthOfField(newDepthOfFieldEffect)
local currentDepthOfFieldEffect = Lighting:FindFirstChildOfClass("DepthOfFieldEffect")
local DepthOfFieldEffectProperties = {
FarIntensity = newDepthOfFieldEffect.FarIntensity,
FocusDistance = newDepthOfFieldEffect.FocusDistance,
InFocusRadius = newDepthOfFieldEffect.InFocusRadius,
NearIntensity = newDepthOfFieldEffect.NearIntensity
}
local DepthOfFieldEffectTransition = TweenService:Create(currentDepthOfFieldEffect, TweenInfo.new(1), DepthOfFieldEffectProperties) -- Update the "TweenInfo.new(1)" with your preferred settings to customize how the values of the DepthOfFieldEffect will change (how quickly and the EasingStyle/Direction)
DepthOfFieldEffectTransition:Play()
end
local function CreateZone(container)
local customZone = Zone.new(container)
customZone:bindToGroup("EnterOnlyOneZoneAtATime")
customZone.localPlayerEntered:Connect(function()
local DepthOfFieldEffectCheck = container:FindFirstChildOfClass("DepthOfFieldEffect")
if DepthOfFieldEffectCheck then
UpdateDepthOfField(DepthOfFieldEffectCheck)
end
local transition = TweenService:Create(Atmosphere, TweenInfo.new(1), container:GetAttributes())
transition:Play()
end)
customZone.localPlayerExited:Connect(function()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local OriginalDepthOfFieldEffect = ReplicatedStorage.OriginalDepthOfFieldEffect -- This and the line of code above could be added to the top of the LocalScript if you'd like
UpdateDepthOfField(OriginalDepthOfFieldEffect)
local transition = TweenService:Create(Atmosphere, TweenInfo.new(1), defaultAtmosphere)
transition:Play()
end)
---
local connection
local function DestroyZone()
customZone:unbindFromGroup("EnterOnlyOneZoneAtATime")
customZone:destroy()
connection:Disconnect()
connection = nil
end
connection = container.AncestryChanged:Connect(function()
if container.Parent ~= atmosphereZones then
DestroyZone()
end
end)
container.Destroying:Connect(DestroyZone)
end
for _, container in ipairs(atmosphereZones:GetChildren()) do
CreateZone(container)
end
atmosphereZones.ChildAdded:Connect(CreateZone)
--[[
This is Episode 10 of Emancyphur's Roblox Studio Tutorial Series!
The full list of instructional scripts from this series can be
found through the description of the Roblox group that posted this model.
]]--
hey dude, massive thank you for your help! (idk if this is too much, but) I really appreciate you taking the time to respond to my question on this video. It was kind of surprising to see you reply, especially since it’s a two-year-old video. It’s awesome to see how dedicated and patient you are, not just in the comments but also on Discord and elsewhere. Your clear, in-depth responses really stand out, and it’s something I genuinely have come to respect. Thanks for being so humble and putting in the effort to assist everyone. It truly makes a difference for alot of new developers, just like me
Thank you so much! also your videos helping me a lot! subscribed!
You are way too underrated man.
How do I make it so if you walk into a Zone you hear a sound and if you walk out of it you stop hearing it?
6:10 where do i find this script. Im having trouble finding it.
It's included with the setup model in the "Resources" section of the description (I'll link it at the end of this comment, too). If you get it from the model on the Roblox website, it can be found via the Atmosphere Resources folder -> Adding Attributes Code -> Attributes Command Bar Code (inside of a LocalScript). If you get it from the GitHub Repository, it's currently found via Roblox Studio Tutorial Series -> Episodes 1-100 -> Episodes 1-10 -> [Last Folder] Episode 10 - Atmosphere -> Attributes Command Bar Code.
1⃣ [Atmosphere Resources - Setup Model w/Source Code] www.roblox.com/library/10348226901
Alternatively, the source code and an optional model download can be found on this GitHub Repository ► github.com/Emancyphur/Roblox-Studio-Tutorials
Hey, are you going to make a part 2 to your class/loadout system video?
I have plans to remake the basic loadout system tutorial as well as to create an advanced version of it that has much more functionality as well as data saving. The remake of the existing tutorial will come first; it will likely take some time before I get to creating the advanced tutorial since I intend to create an individual tutorial specifically about saving data prior to creating any tutorials that involve DataStores.
@@Emancyphur Ok, thank you very much for replying.
followed it step by step and doesnt work for me? has it been changed from 11 months ago?
Are you referring to the Custom Atmosphere Zones not working at all, or something else from the video? As far as I'm aware, nothing has changed with how it works since the video's release. Please check the Output to see if there are any errors occurring related to the scripts from the video. I'd also recommend taking a look at the setup model in the description and comparing the custom zones provided there to see if there's any differences between that and the ones you created. I checked to make sure that it still works before replying to your comment, and it still seems to be functioning correctly when testing it in a brand new place without anything else added to the game. I'd recommend using the custom zones provided (as well as the provided LocalScript for the StarterPlayerScripts in case there are any discrepancies between that and if you wrote it manually while watching the video) so you could modify the custom zones to the desired values to get everything working more quickly.
@@Emancyphur thank you for the reply! I’ll try again in a new place, just recently started to develop my own game so i am new to coding in roblox.
you're just saved me! thank you very much!
I got lost from 6:07 to the end. You explained things amazingly and went through all the steps before that, but when you started to not give much context i got very confused
I appreciate the feedback! Later in this comment, I'll try to explain that half of the video more clearly to make it easier to understand.
Before getting to that, I want to let you know that there’s a completed version of the Custom Atmosphere Zones system from this tutorial (with written instructions) in the "Resources" section of the video description (I'll also link it right after this paragraph) that you can use and reference in case that's easier than following along with the video. With that out of the way, if you have any additional questions after reading through the rest of this comment, please reply to this comment to let me know!
1⃣ [Atmosphere Resources - Setup Model w/Source Code] create.roblox.com/marketplace/asset/10348226901
Alternatively, the source code and an optional model download can be found on this GitHub Repository ► github.com/Emancyphur/Roblox-Studio-Tutorials
---
*Section of the comment where I try to explain the last half of the video more clearly starts here!*
The section of the video from 5:50 until 6:55 explains two different ways to add Attributes (which are essentially custom properties) to the Atmosphere Zones we created. We're doing this for two main reasons. The first reason is because the LocalScript will need to know which properties of the Atmosphere (such as the Color, Offset, Density, etc.) need to be updated and what the new values will be updated to when a player enters the zone. The second reason is because Attributes are more user-friendly than some of the other options (which could have included creating ValueObjects such as NumberValue and Color3Value, which would have likely needed to be stored within the Atmosphere Zones, creating clutter and being more difficult to find since it would appear in the Explorer and be mixed among the parts that make up the zone. Another option could have been to define the new values inside of the script, but that is not as intuitive because over time, it'd be more difficult to know which lines of code correspond with each zone in the AtmosphereZones folder). By creating Attributes for each of the zones, developers can select the zone they want to review / update and then scroll to the bottom of the Properties window to be immediately more certain about how the Atmosphere will appear when entering each zone (without needing to select individual ValueObjects separately or search through an entire script) while also being able to quickly and easily update those values whenever they'd like.
In order to create those Attributes for each of the zones, I outlined two different options. The first way (shown from 6:02 to 6:21 in the video) utilizes code to automatically create Attributes for every zone included in the AtmosphereZones folder at the time. By running the code in Roblox Studio's command bar, it looks through the first layer of the AtmosphereZones folder, checks if it has the necessary Attributes (which are identical in Name and Type to each of the main properties of the Atmosphere object), and if it doesn't, it creates those Attributes for you. This option is preferred if you have a lot of zones since it saves a ton of time and limits the amount of mistakes that could be made had it been created manually, one by one. If you're interested in a full explanation of how the code works (which also explains some of the same things I've talked about in this comment in a more visual way), I created a separate video focusing on that and included it in the "Resources" section of the description (and here's a link to the video for your convenience: th-cam.com/video/a9YVpLZUh5w/w-d-xo.html ). The second way (shown from 6:22 to 6:43 in the video) is the manual way of creating Attributes, one at a time, corresponding with each property of the Atmosphere object you want to change when players enter the zone. If someone does not want to use the code I wrote to automatically add Attributes to each of the zones, then this would be the option to follow along with. From 6:37 to 6:44, I explain what the Name of each Attribute is supposed to be and what to select for the Attribute's Type (e.g. Number and Color3 values) to ensure that it aligns with the Name and Type for each of the Atmosphere object's main properties. At 6:44 in the video, I explain how to remove Attributes from a zone if you don't want certain properties to be updated when players enter the zone (so it won't update every property all at once, just the ones you choose). After that, from 6:56 to 7:15 I explain that the values of each of the Attributes will determine what the Atmosphere will look like when the player enters that zone (and I explain how to preview what the Atmosphere will look like when the player enters that zone).
Starting at 7:16, we begin to write the code that will allow the Custom Atmosphere Zones to have functionality (so that the Atmosphere will change when players enter each zone). For the code to work as intended, we're making use of the ZonePlus module (which I explain what that is, why we need it, how to add it into the game, and where it needs to be placed in the game from 3:31 to 4:15 in the video). Since I already explained in the video from 7:28 to 12:32 what each section of the code in the LocalScript does and what could be customized to fit your needs, please let me know what specifically about this last section of the video confused you so that I can provide a more robust explanation that'll make it easier to understand.
If you have any additional questions about anything in this comment or in the video, please let me know and I'll try to help out some more!
you are a legend.
is good video!
yes!
thanks
how can i make this change the skybox too? (i saw you answered to another comment with this same question and can you please send the script that you sent to him but merged with the original script? i mean the full script, thanks)
Here's the full LocalScript code after making those changes (but take note that in order for it to work, you would also need to make changes to the AtmosphereZones folder, including adding the desired zone-specific skyboxes into folder that was created for that specific zone, as described in that post. For ease of access, I'll include the explanation for that here, right before the full code):
"There's a few things that would need to be updated for skyboxes to be integrated into the system, starting with finding a way to define what skybox will be used for each zone. The simplest way of achieving this would likely start with adding the Sky object directly into the zone within the "AtmosphereZones" folder. Additionally, make sure that a copy of the original skybox (the one that should be visible when the player is not in any custom zones) is kept in a spot that is easy for the LocalScript to reference so that the LocalScript will be able to change it back when the player exits a custom zone. For this example, I'll keep it directly in the ReplicatedStorage and it'll be called "OriginalSkybox"."
---
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Lighting = game:GetService("Lighting")
local TweenService = game:GetService("TweenService")
local Zone = require(ReplicatedStorage.Zone)
if not Lighting:FindFirstChildOfClass("Atmosphere") then
warn("There wasn't an Atmosphere object in the Lighting! Creating a new one...")
local newAtmosphere = Instance.new("Atmosphere")
newAtmosphere.Name = "Atmosphere"
newAtmosphere.Parent = Lighting
end
local Atmosphere = Lighting.Atmosphere
local atmosphereZones = workspace.AtmosphereZones
local defaultAtmosphere = {
Density = Atmosphere.Density,
Offset = Atmosphere.Offset,
Color = Atmosphere.Color,
Decay = Atmosphere.Decay,
Glare = Atmosphere.Glare,
Haze = Atmosphere.Haze
}
---
local function UpdateSkybox(newSkybox)
local currentSkybox = Lighting:FindFirstChildOfClass("Sky") -- Updated to use ":FindFirstChildOfClass()" so that it will find the skybox, regardless of what it was renamed to
local skyboxProperties = {
CelestialBodiesShown = newSkybox.CelestialBodiesShown,
MoonAngularSize = newSkybox.MoonAngularSize,
MoonTextureId = newSkybox.MoonTextureId,
SkyboxBk = newSkybox.SkyboxBk,
SkyboxDn = newSkybox.SkyboxDn,
SkyboxFt = newSkybox.SkyboxFt,
SkyboxLf = newSkybox.SkyboxLf,
SkyboxRt = newSkybox.SkyboxRt,
SkyboxUp = newSkybox.SkyboxUp,
StarCount = newSkybox.StarCount,
SunAngularSize = newSkybox.SunAngularSize,
SunTextureId = newSkybox.SunTextureId,
}
for propertyName, newValue in skyboxProperties do
currentSkybox[propertyName] = newValue
end
end
local function CreateZone(container)
local customZone = Zone.new(container)
customZone:bindToGroup("EnterOnlyOneZoneAtATime")
customZone.localPlayerEntered:Connect(function()
local skyboxCheck = container:FindFirstChildOfClass("Sky")
if skyboxCheck then
UpdateSkybox(skyboxCheck)
end
local transition = TweenService:Create(Atmosphere, TweenInfo.new(1), container:GetAttributes())
transition:Play()
end)
customZone.localPlayerExited:Connect(function()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local originalSkybox = ReplicatedStorage.OriginalSkybox -- This and the line of code above could be added to the top of the LocalScript if you'd like
UpdateSkybox(originalSkybox)
local transition = TweenService:Create(Atmosphere, TweenInfo.new(1), defaultAtmosphere)
transition:Play()
end)
local connection
local function DestroyZone()
customZone:unbindFromGroup("EnterOnlyOneZoneAtATime")
customZone:destroy()
connection:Disconnect()
connection = nil
end
connection = container.AncestryChanged:Connect(function()
if container.Parent ~= atmosphereZones then
DestroyZone()
end
end)
container.Destroying:Connect(DestroyZone)
end
for _, container in ipairs(atmosphereZones:GetChildren()) do
CreateZone(container)
end
atmosphereZones.ChildAdded:Connect(CreateZone)
@@Emancyphur thanks😁
Oh yeah I have a question. How would I add to this zone code to also modify all the properties under the "Lighting" tab (like ColorShift_Top, Ambient, ClockTime, etc)? Thanks for the help if you see this!
That would be possible to implement but you'd also need to add more TweenService-related code to the functions activated by the "localPlayerEntered" & "localPlayerExited" events (at around 10:23 in the video).
Here's an example of how that can be achieved for something like changing the ClockTime:
local updateTime = TweenService:Create(Lighting, TweenInfo.new(1), {ClockTime = 20})
updateTime:Play()
If you wanted the ClockTime to be updated differently for every single zone you enter, further changes would need to be made to the code, specifically to the way the Atmosphere transition retrieves all the Atmosphere-related Attributes, since adding any Attributes to a zone that correspond with properties of other objects that are not the Atmosphere object would not work with the current set up. It wouldn't work right away because we call "container:GetAttributes()" for the Atmosphere transition (which gets all of the Attributes of a zone) meaning it would error if it is told to update a property that the Atmosphere object doesn't have.
It may be possible to somewhat easily make this scalable by structuring it in a similar way to how I've revised the code for other developers who posted questions in this comments section regarding how to update other Lighting-related objects (such as ColorCorrection and DepthOfField) but with the ValueBase objects to represent the given properties of the Lighting service (such as Color3Value for the ColorShift / Ambient, NumberValue for ClockTime, etc.)
Unfortunately, I didn't talk much about updating properties of the Lighting Service via a script in this video since the tutorial is based around the Atmosphere object and not Lighting in general. Maybe I'll create another tutorial in the future that explains how to efficiently achieve the same effect but with as many properties of the Lighting Service & other relevant Lighting Objects. In the meantime, let me know if you have any further questions about the suggestions I made above. The revised code for Lighting-related objects I mentioned can be found in very recent comments (the one from a week ago right before your comments is the one where I explained how to change the DepthOfField) so I'd recommend referencing that if you're curious about how that was implemented to see how it may be able to be applied to the Lighting service properties.
@@Emancyphur Thanks for the help dude, I'll let you know if I make it work for different zones!
@@Emancyphur ok I actually managed to get it to mostly work! Here's the code (centered around the new parts added):
local defaultAtmosphere = {
Density = Atmosphere.Density,
Offset = Atmosphere.Offset,
Color = Atmosphere.Color,
Decay = Atmosphere.Decay,
Glare = Atmosphere.Glare,
Haze = Atmosphere.Haze,
}
local function UpdateRays(newRays)
local currentRays = Lighting:FindFirstChildOfClass("SunRaysEffect")
local SunRaysProperties ={
Intensity = newRays.Intensity,
Spread = newRays.Spread
}
local RaysTransition = TweenService:Create(currentRays, TweenInfo.new(1), SunRaysProperties)
RaysTransition:Play()
end
local function UpdateScorch(newScorch)
local CurrentTime = Lighting.ClockTime
local CurrentColorTop = Lighting.ColorShift_Top
local updateTime = TweenService:Create(Lighting, TweenInfo.new(1), {ClockTime = 6.2})
local updateColor = TweenService:Create(Lighting, TweenInfo.new(1), {ColorShift_Top = Color3.fromRGB(255,87,20)})
updateTime:Play()
updateColor:Play()
end
local function CreateZone(container)
local customZone = Zone.new(container)
customZone:bindToGroup("EnterOnlyOneZoneAtATime")
customZone.localPlayerEntered:Connect(function()
local SunRaysCheck = container:FindFirstChildOfClass("SunRaysEffect")
if SunRaysCheck then
UpdateRays(SunRaysCheck)
end
local ScorchCheck = container:FindFirstChild("ScorchNote")
if ScorchCheck then
UpdateScorch(ScorchCheck)
end
local transition = TweenService:Create(Atmosphere, TweenInfo.new(1), container:GetAttributes())
transition:Play()
end)
customZone.localPlayerExited:Connect(function()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local OriginalRays = ReplicatedStorage.OriginalRays
UpdateRays(OriginalRays)
local transition = TweenService:Create(Atmosphere, TweenInfo.new(1), defaultAtmosphere)
transition:Play()
end)
--------------------------------
The UpdateRays function updates the rays based on if there's a SunRaysEffect in the zone, similar to your Depth of Field effect in an earlier comment.
The UpdateScorch function updates values in an area I'm making (called the Scorchlands), so far I only have ClockTime and ColorShift_Top but I can scale this to all of them I think. For the ScorchCheck in the CreateZone function, I'm just using a blank script with the name "ScorchNote" in the Scorchland zone to notify the checker to update the values. I haven't set the exiting code yet but it works when entering the zone!
I know this probably isn't the most efficient way of doing it but I'm more of a builder than a scripter so just making do with what I can figure out :/ Should at least help others with similar plans.
Tysm bro 👍
Thank you, incredibly helpful and very underrated channel!
where's the best place to get support on this? i have a folder of smaller areas inside a larger area and sometimes it correctly identifies the smaller areas and sometimes it doesn't. i'm assuming it fails when things are loading in random order on the client
Just to have some additional context beforehand, are you intending for both the larger area and smaller areas to have custom atmosphere zones, or just the smaller areas? Along with that, toward the beginning of the Script, which folder out of the two you mentioned is referenced for the "AtmosphereZones" variable? If it's the folder with the smaller areas, then the code should be able to account for areas in that folder that happen to be streamed in to the client after the code first ran because it also runs the "CreateZone" function when the ChildAdded event fires for the AtmosphereZones folder.
Consider adding a print statement at the beginning of the "CreateZone" function, such as "print(container.Name)" so that you can check in the Output which objects it's creating a zone for each time you start a playtest.
@@Emancyphur i had one giant single part as a city block, and a folder with three smaller parts meant to be the alley. i thought i read somewhere that it would support this, and assumed was a bug since sometimes when i ran it, some of the smaller parts were detected and sometimes not. with the video being so old i figured i was on my own, so i did the obvious and just spit the big part up into multiple ones so there was no more overlapping. but if there is a better fix i am interested for other parts of my city!
@@furroy While there doesn't seem to be a built-in feature for that at the moment, someone recently posted a custom solution for that situation on the Developer Forum thread for the ZonePlus Module. I personally haven't tested it out myself yet but it seems like it would work well for the use case you described. Here's the post, for reference: devforum.roblox.com/t/1017701/730
For some reason, whenever I try to change the value of atmosphere density via a .touched function (localscript, with debounce) it doesn't work. I put a print script inside and it worked so the .touched function isn't the problem. ANy advice?
Are there any errors appearing in the Output from the script? If you'd like to, you could paste the relevant parts of the LocalScript as a comment here so I could review it to see if I notice anything that might be preventing it from working properly
@@Emancyphur Oh, it turns out that the function i was using didn't actually detect if the hitPart (thing that touched the trigger) was a human or not, I fixed it by using more if statements. Thank you for trying to help though, your videos are awesome. Much love 😃
can you add more atributes to the part? Everything in lighting? For exampe, time of day?
That would be possible but you'd also need to add more TweenService-related code to the functions activated by the "localPlayerEntered" & "localPlayerExited" events (at around 10:23 in the video).
An example of that is the following:
local updateTime = TweenService:Create(Lighting, TweenInfo.new(1), {ClockTime = 20})
updateTime:Play()
If you wanted the ClockTime to be updated differently for every single zone you enter, further changes would need to be made to the code, specifically to the way the Atmosphere transition retrieves all the Atmosphere-related Attributes, since adding any Attributes to a zone that correspond with properties of other objects that are not the Atmosphere object would not work with the current set up because we call "container:GetAttributes()" for the Atmosphere transition (which gets all of the Attributes of a zone) meaning it would error if it is told to update a property that the Atmosphere object doesn't have.
I know I commented not that long ago but i need a bit more help. I tried looking on the devforum and found stuff related but nothing that solved my question.
My quesiton: Is there a way to use string.find and string.lower together?
My script:
local String = "hello"
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
if string.find(msg, string.lower(String)) then
print(plr.Name.." Said hello!")
end
end)
end)
and it works good and all, but not if I use capitals. Is there any way to make this work?
Sorry for the late response; your message was automatically held for review so I didn't see it until now. The example you posted is very close to the solution already! If you add string.lower() to the "msg" variable within the string.find() function, that will convert any uppercase letters within the player's message to lowercase. That way, so long as the player sends the correct message (regardless of capitalization), it'll meet the conditional statement. Here's what that might look like:
if string.find(string.lower(msg), string.lower(String)) then
-- If you want to make it look cleaner, then here's another option
local lowercaseMessage = string.lower(msg)
local lowercaseString = string.lower(String)
if string.find(lowercaseMessage, lowercaseString) then
@@Emancyphur Thanks, andI have one more question. I want to monetize my game more but it will be hard since i have very little playerbase, so i want to give out rewards for referring friends. What im thinking is if someone is in a game with their friend they get some sort of boost, not sure what because i dont know how to make datastores. When i learn how to do this i want to do a simple thing like
Play for 1 minute -> Get coins
Play with a friend -> Get coins
In group -> Get coins
Spend coins -> Permanently get items that used to be robux only
so maybe for every 100 robux its about 2500 coins and you get around:
20 coins/minute
30 coins/minute if you're playing with a friend
30 coins/minute if you're in a group
40 coins/minute if you're playing with friend and in a group
I only need to know how to do if you're playing with a friend because i already know all the others.
I think this will help the game get more mainstream and get me more robux which will help pay for badges and stuff to make the user play more.
Sorry for the insanely long question, lol
if i want to make everyone see the same atmosphere at the same time, do i need to make a script for that or can i just update it in properties i didnt really understand
If everyone should see the updated Atmosphere at the same time no matter where they are in the game, then yes, you would just update the Atmosphere object in the Lighting service. If you need it to be updated at any point while the game is running, you can change it from a Server script and the new Atmosphere will be seen by all players in the game.
There are some examples at 2:38 in the video that showcase how you can use Scripts to change the Atmosphere mid-game.
can you also add in new lighting effects e.g bloom, blue, color correction, field of view?
On its own, yes, those Lighting effects would work with the Atmosphere object. However, if you want those objects to be updated when entering / exiting the custom Atmosphere zones, that would be possible, but you'd also need to add more TweenService-related code to the functions activated by the "localPlayerEntered" & "localPlayerExited" events (at around 10:23 in the video).
Here's an example of how that can be achieved for something like changing the Bloom:
local updateBloom = TweenService:Create(Lighting, TweenInfo.new(5), {Intensity = 1, Size = 50, Threshold = 0.8})
updateBloom:Play()
If you wanted the Bloom or any other additional Lighting effects to be updated differently for every single zone you enter, further changes would need to be made to the code, specifically to the way the Atmosphere transition retrieves all the Atmosphere-related Attributes, since adding any Attributes to a zone that correspond with properties of other objects that are not the Atmosphere object would not work with the current set up. It wouldn't work right away because we call "container:GetAttributes()" for the Atmosphere transition (which gets all of the Attributes of a zone) meaning it would error if it is told to update a property that the Atmosphere object doesn't have.
Unfortunately, I didn't talk much about updating properties of the Lighting Service / other Lighting objects via a script in this video since the tutorial is based around the Atmosphere object and not Lighting in general. Maybe I'll create another tutorial in the future that explains how to achieve the same effect but with as many properties of the Lighting Service & other relevant Lighting Objects.
@@Emancyphur funny enough thats exactly what i did,i even added audio with it! So its a 2 in one lighting zones and audio zones,it works absolutely flawless,also yeah that would be a great idea for a tutorial,thanks for the info!
WHERES THE COPY PASTE IN THE SCRIPT THERE IS NOT COPY PASTE
If you are referring to the Instructions provided within the Atmosphere Resources model (and to be specific, the section that talks about how to automatically add Attributes to each of the custom zones), I clearly outlined where to find the code that is meant to be copy and pasted into the command bar (which is the code within the LocalScript called "Attributes Command Bar Code". The LocalScript can be found in the "Adding Attributes Code" folder that's part of the provided resources in the Atmosphere Resources model).
For reference, here are the instructions:
Automatic Option:
a1. Open the "Adding Attributes Code" folder.
a2. Open the "Attributes Command Bar Code" LocalScript.
a3. Copy and paste the code from the LocalScript into Roblox Studio's Command Bar at the bottom of the screen (this can be enabled through the "View" tab at the top left of the screen)
a4. Press "Enter" on the keyboard to run the code in the command bar. The "Output" should indicate how many remaining Attributes were added to each of the items
a5. After that, every item on the first layer of the "AtmosphereZones" folder will have Attributes / custom properties
If you can't find it, here is the code that is meant to be copy and pasted that is being talked about in the instructions:
-- This is an optional resource for adding Attributes to the custom zones
-- Instructions for this can be found in the "Instructions" LocalScript within the "Custom Atmosphere Zones" folder
local function CreateAttributes()
local atmosphereAttributes = {
Density = 0,
Offset = 0,
Color = Color3.fromRGB(255,255,255),
Decay = Color3.fromRGB(255,255,255),
Glare = 0,
Haze = 0
}
for _, container in pairs(workspace.AtmosphereZones:GetChildren()) do
local totalAttributesAdded = 0
for attributeName, defaultValue in pairs(atmosphereAttributes) do
if not container:GetAttribute(attributeName) then
totalAttributesAdded += 1
container:SetAttribute(attributeName, defaultValue)
end
end
warn("Successfully added "..totalAttributesAdded.." Attributes for "..container.Name)
end
end
CreateAttributes()
@@Emancyphurgoated
Yo where can i have it so its only fog and the atmosphere does not add the skybox
If you only want Fog, then you don't need to use Atmosphere for that, as there are "FogStart" "FogEnd" and "FogColor" properties of the Lighting service for that which work so long as there isn't an Atmosphere object in the Lighting.
Roblox Creator Hub API Documentation resources:
FogStart: create.roblox.com/docs/reference/engine/classes/Lighting#FogStart
FogEnd: create.roblox.com/docs/reference/engine/classes/Lighting#FogEnd
FogColor: create.roblox.com/docs/reference/engine/classes/Lighting#FogColor
"CanQuery" doesn't appear as an option under collision for a part. Does anyone know why?
The "CanQuery" property will only appear in the Properties window for a part if "CanCollide" is turned off. If "CanCollide" is turned on, "CanQuery" should already be enabled by default.
@@Emancyphur ay thanks a lot man I found it eventually but I really appreciate the help. This video was super well made and helpful. Well worthy of liking and subscribing
I keep getting Attempted to call require with invalid argument(s), for client LocalScript:5 which is line 5 something is wrong with the required argument, I also renamed and swapped the folder with the folder Zone so it would work removing the previous error of "folder named zone needed" (something like that) and it still wont fix, also it says container is a "Unknown global" what do I do??
Make sure you've added the "Zone" ModuleScript into the "ReplicatedStorage" service like we did at 3:52 in the video (which is from the "ZonePlus" model showcased at 3:39 in the video: www.roblox.com/library/6245329519/ZonePlus ). If you already added it there, please paste what was written for line 5 of the LocalScript -- it should match up with what was shown at 7:39 in the video.
As far as the folder goes, there should be a folder directly in the Workspace called "AtmosphereZones" (with that specific spelling and capitalization). That's the folder that will store all of the custom zones so the LocalScript can easily find it
@@Emancyphur I did all of your steps in the video, I even typed it all out myself while watching ur video, everytime I get an error its the same "Attempted to call require with invalid argument(s)" stack begins the script players local script LINE 5, stack immediately ends, so I don't know what to fix, this type of error I looked up and its a problem with the require (specifically the argument in line 5) do you know of any solution? Also I tried adding a folder named Zone and playing the module script under it, to fix the error of "zone container must have a folder, model, table.... to work" which fixed that, but then the final boss comes in and its an invalid argument.
@@Emancyphur Nevermind I fixed it
is there anyway i can change the haze using a script and the "wait(?)" command? please let me know :]
Do you mean you only want to change the "Haze" property of the Atmosphere when entering one of the custom zones, or is your question completely separate from the custom zones? And could you clarify what you mean by wanting to change it along with using the "wait(?)" command? Do you mean you want it to wait a certain amount of time before changing, to repeat between different values after waiting a certain amount of time, to have a smooth transition from one value to another that takes a certain amount of time, etc.? I'm not super sure what exactly you want to achieve, so I would appreciate it if you explain it a bit more so that I can try to explain a possible solution
@@Emancyphur completely seperate to the custom zones, i want to change the background haze colour after a certain time has passed but everything ive tried hasnt worked.
@@sig_enthusiast Oh, in that case, it would be more similar to the examples I showed from 2:38 to 3:25 in the video. Here are some examples of how you could achieve that:
--- Example 1
local Lighting = game:GetService("Lighting")
local Atmosphere = Lighting.Atmosphere
local function updateAtmosphere()
task.wait(5)
print("5 seconds has passed! Updating the Atmosphere's 'Haze' property to a new Color3 value.")
Atmosphere.Haze = Color3.new(0, 0, 0) -- Update it to the new Color3 value you want
end
updateAtmosphere() -- Calls the function with the name "updateAtmosphere" so the script knows it needs to run the code inside that function
---
However, in that example, the function will only run once, at the same time the game starts up. If you want it to update the Atmosphere at different points in time, the function would need to be called again. For example, if you wanted to update it whenever a certain ClockTime has been reached in-game (so it changes depending on if it's the morning, afternoon, night time, etc.) then that would need to make use of events so that the script is listening for it to reach specific time(s) of day:
--- Example 2
local Lighting = game:GetService("Lighting")
local Atmosphere = Lighting.Atmosphere
local function updateAtmosphere(newColor3Value)
task.wait(5)
print("5 seconds has passed! Updating the Atmosphere's 'Haze' property to a new Color3 value.")
Atmosphere.Haze = newColor3Value -- Update it to the new Color3 value you want
end
local nightTimeAtmosphereColor = Color3.new(0, 0, 0)
local fullDayAtmosphereColor = Color3.new(1, 1, 1)
Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
local currentClockTime = Lighting.currentClockTime
local currentAtmosphereHazeColor = Atmosphere.Haze
if currentClockTime >= 20 and not (currentAtmosphereHazeColor == nightTimeAtmosphereColor) then
updateAtmosphere(nightTimeAtmosphereColor)
elseif currentClockTime >= 5 and currentClockTime < 20 and not (currentAtmosphereHazeColor == fullDayAtmosphereColor) then
updateAtmosphere(fullDayAtmosphereColor)
end
end)
---
I can explain more about how the code works if either of these examples matches what you are trying to achieve. If I didn't answer your question or if you have additional questions, feel free to let me know and I'll try to answer!
Additional Resources:
Documentation for the "ClockTime" property of the Lighting Service (Roblox Creator Documentation site): create.roblox.com/docs/reference/engine/classes/Lighting#ClockTime
Documentation for the ":GetPropertyChangedSignal()" method (Roblox Creator Documentation site): create.roblox.com/docs/reference/engine/classes/Instance#GetPropertyChangedSignal
@@Emancyphur Thanks, ill try this later and ill let you know if it works. Thanks a bunch!
how do i make it so that when a player triggers a proximity prompt, the atmosphere changes (while the player is inside the atmosphere zone)
Oh my, I was never notified of this comment; sorry about taking such a long time to reply! Would you still like help with creating that, or not anymore? If you do, then I have some follow-up questions about the specifics of how that would work:
1. If the player activates the ProximityPrompt inside of the zone and then leaves the zone, would you want the Atmosphere to change back to the default settings? If so, when the player walks back into the zone, would you want it to automatically swap to the custom Atmosphere properties of that zone or would the player need to re-activate the ProximityPrompt every single time they enter that zone for the Atmosphere to change again?
2. If the player activates the ProximityPrompt inside of a custom zone, waits a moment, and then activates it again, would you want that to deactivate the custom properties (e.g. making it go back to the default Atmosphere) or for it to not change anything?
3. Do you want it to function that way for every single Atmosphere zone, or just specific ones?
And if the specifics of what you wanted to create have changed since you posted the comment 2 months ago, feel free to let me know so that I make sure any code samples I provide will match what you are looking for now
@@Emancyphur thank you so much i was stuck and i quit developing my game, i can continue now because of you.
@@Emancyphur 1. yes i would, the player has to re-activate the proximity prompt every time.
2. i dont want the player to deactivate the custom properties, i want the properties to deactivate automatically after a certain amount of time.
3. i want it to function that way for only specific atmosphere zones.
the specifics of what i wanted to create remains the same since i posted the comments.
once again, thank you for reaching out.
@@neosigma4 I'm happy to hear that this'll allow you to continue developing your game (but also I apologize again because that is 2 months where I could have responded to help much sooner!)
Thanks for clarifying further; I'll try to respond again soon-ish with a completed example but as a heads-up, I have a fairly busy schedule this weekend and I am not feeling 100% at the moment so it may be a couple more days before I get back with a working example.
@@neosigma4 Oh one more question; you mentioned in your answer to the second question that you want the properties to automatically deactivate after a certain amount of time. What would the requirements for this be (e.g. does the timer start from the moment that the player activates the ProximityPrompt? Or does it start the moment they exit the custom zone?)
How would I be able to change the time of day when touching the part?
That would be possible but you'd also need to add more TweenService-related code to the functions activated by the "localPlayerEntered" & "localPlayerExited" events (at around 10:23 in the video).
An example of that is the following:
local updateTime = TweenService:Create(Lighting, TweenInfo.new(1), {ClockTime = 20})
updateTime:Play()
If you wanted the ClockTime to be updated differently for every single zone you enter, further changes would need to be made to the code, specifically to the way the Atmosphere transition retrieves all the Atmosphere-related Attributes, since adding any Attributes to a zone that correspond with properties of other objects that are not the Atmosphere object would not work with the current set up because we call "container:GetAttributes()" for the Atmosphere transition (which gets all of the Attributes of a zone) meaning it would error if it is told to update a property that the Atmosphere object doesn't have.
---
If I remember correctly, the creator of the ZonePlus module has an open-sourced example place that includes an example of changing the time of day through the custom zones: www.roblox.com/games/6166477769/ZonePlus-Playground
I have a small question, I'm curious on if it's possible to have it also change the Color correction of certain zones, if so, I'd really like to know how.
That would be possible, but you'd also need to add more TweenService-related code to the functions activated by the "localPlayerEntered" & "localPlayerExited" events (at around 10:23 in the video).
There's a few things that would need to be updated for that to be integrated into the system, starting with finding a way to define what the new ColorCorrectionEffect values would be for each zone. The simplest way of achieving this with making minimal changes to the system would start with adding a customized ColorCorrectionEffect object directly into the zone within the "AtmosphereZones" folder. Additionally, make sure that a copy of the original ColorCorrectionEffect (the one that should be visible when the player is not in any custom zones) is kept in a spot that is easy for the LocalScript to reference so that the LocalScript will be able to change it back when the player exits a custom zone. For this example, I'll keep it directly in the ReplicatedStorage and it'll be called "OriginalColorCorrectionEffect".
Next, the sections of code that would need to be updated in the LocalScript are above and within the functions activated from the "localPlayerEntered" & "localPlayerExited" events (pause the video at around 10:55 to see where this new code would go in relation to the existing code). The main purpose of the changes will be to check if the custom zone that the player has entered has a ColorCorrectionEffect, and if so, we'll loop through all of its properties and then replace the current ColorCorrectionEffect's properties with the brand new one. If you need any additional clarification about how the code works, feel free to ask! Here's what the brand new code would look like (starting from right before the "CreateZone" function all the way until the point where the changes to the code end):
---
local function UpdateColorCorrection(newColorCorrectionEffect)
local currentColorCorrectionEffect = Lighting:FindFirstChildOfClass("ColorCorrectionEffect") -- Fixed error; originally looked for an object named "ColorCorrectionEffect" but that is not the default name of the object. Switched it to look for the object based on ClassName so it works regardless of whether or not it was renamed.
local ColorCorrectionEffectProperties = {
Brightness = newColorCorrectionEffect.Brightness,
Contrast = newColorCorrectionEffect.Contrast,
Saturation = newColorCorrectionEffect.Saturation,
TintColor = newColorCorrectionEffect.TintColor
}
local ColorCorrectionEffectTransition = TweenService:Create(currentColorCorrectionEffect, TweenInfo.new(1), ColorCorrectionEffectProperties) -- Update the "TweenInfo.new(1)" with your preferred settings to customize how the values of the ColorCorrectionEffect will change (how quickly and the EasingStyle/Direction)
ColorCorrectionEffectTransition:Play()
end
local function CreateZone(container)
local customZone = Zone.new(container)
customZone:bindToGroup("EnterOnlyOneZoneAtATime")
customZone.localPlayerEntered:Connect(function()
local ColorCorrectionEffectCheck = container:FindFirstChildOfClass("ColorCorrectionEffect")
if ColorCorrectionEffectCheck then
UpdateColorCorrection(ColorCorrectionEffectCheck)
end
local transition = TweenService:Create(Atmosphere, TweenInfo.new(1), container:GetAttributes())
transition:Play()
end)
customZone.localPlayerExited:Connect(function()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local OriginalColorCorrectionEffect = ReplicatedStorage.OriginalColorCorrectionEffect -- This and the line of code above could be added to the top of the LocalScript if you'd like
UpdateColorCorrection(OriginalColorCorrectionEffect)
local transition = TweenService:Create(Atmosphere, TweenInfo.new(1), defaultAtmosphere)
transition:Play()
end)
---
Sorry that this wasn't included in the original tutorial; I didn't address the properties of the Lighting Service and other Lighting-related objects since this tutorial was based around the Atmosphere object and not Lighting in general. Maybe I'll create another tutorial in the future that explains how to achieve the same effect but with many of the available Lighting effects, but for now, I hope this comment was useful! If you have any additional questions, feel free to ask.
@@Emancyphur You sir, are a godsend, thank you a ton! I'll definitely be looking forward to any future videos you may do, have a good rest of your day.
@@Emancyphur Hello, me again. I've come back to this video to try this out; and it seems to not work, although I followed the instructions perfectly, so I'm not exactly sure on where I went wrong with this. This is probably a lot to ask, but would you so mind to make a video showing this process so I can accurately pinpoint what exactly I did wrong. (Or, like you said before, a tutorial regarding other lighting effects plus this one. I think you'd be the first and only creator on YT that actually shows how this is done, as I've never seen any other video alike to this.) Thank you regardless however for even creating this.
@@cheeseman1860 I'll take another look at it to see if I made a mistake and if I figure out something that works I'll provide a full example here (the entire LocalScript code)
@@cheeseman1860 Oh I found out what was causing the issue; when adding the effect into the Lighting service, it is named "ColorCorrection", but its ClassName property is "ColorCorrectionEffect". However, the first line of revised code I wrote within the "UpdateColorCorrection" function errors because it's trying to look for an object with the name of "ColorCorrectionEffect". Unless you specifically renamed the effect in the Lighting service to have the word "Effect" added to the end of it, it'll stop the code from running at that point. After changing that line of code to look for "ColorCorrection" in the Lighting service, it appeared to work as intended. I'll be sure to update my original reply above to include this change so that it'll work right away for anyone else who would like to add that functionality to the custom zones. Hope that this helps :D
Edit: After second thought, I'll be updating that line of code to look for the object by its ClassName, instead of its Name, so that it'll be able to find the object either way
Hi, I'm getting this error when I run the code, any idea on how to fix it or what I did wrong?
Output Error: Getchildren is not a valid member of Folder "Workspace.AtmosphereZones"
The letter "c" needs to be capitalized since it's case-specific, meaning the code would go from atmosphereZones:Getchildren() to atmosphereZones:GetChildren()
@@EmancyphurThank you! I'll go correct it now. I can't believe I managed to overlook such a small error.
Can u make ah tutorial how to make an tool and when u click the tool ah accessory equipped and if u click again the tool the accessory is unequipped and the accessory gives u life like blox fruits or gpo please is an emergency with my game :(
Although I don't have a combined tutorial for that, I already created two separate tutorials for those features which should be able to work together to achieve the effect that you described (one for clicking on an item to equip it and another for a holstering system that allows an Accessory version of a Tool to appear on a player's Character when the Tool has been unequipped):
Click to Equip Hat, Clothing, & Tools Tutorial: [ th-cam.com/video/eWmmZdBM8MY/w-d-xo.html ]
Holstering System Tutorial: [ th-cam.com/video/7_My5xBzQZ4/w-d-xo.html ]
@@Emancyphur can u make ah tutorial pls if u can't don't do it is only that
@@Jack0oxPG3D As I mentioned in my original reply, what you described is possible by combining two existing tutorials that I've published to my channel. One of the tutorials explains how to allow players to click on items to equip it / add it to their in-game Backpack, and the other tutorial explains how to make the Tool appear as an Accessory when the player unequips the Tool. If you have any additional questions, feel free to ask!
@Krabby Patties LMFAO
bro im new at scripting where the hell do i oaste the attrivutes??
You can add Attributes to one of the Custom Zones in two different ways, which can be summed up with the following:
Manual Option (explained from 6:22 to 7:02)
1. Select the zone in the AtmosphereZones folder
2. Look at the "Properties" window (that can be enabled through the "View" tab at the top left of the screen)
3. Scroll down until you see the "Attributes" section
4. Press "Add Attribute", then create Attributes that have the exact same name as the properties of the Atmosphere you want to change (note: the "Type" that you choose for each Attribute is shown at 6:38 in the video)
Automatic Option (explained from 6:02 to 6:21 and if you want to know how the code works, I explain that here: th-cam.com/video/a9YVpLZUh5w/w-d-xo.html ):
1. Open the "Adding Attributes Code" folder from the Atmosphere Resources model.
2. Open the "Attributes Command Bar Code" LocalScript.
3. Copy and paste the code from the LocalScript into Roblox Studio's Command Bar at the bottom of the screen (this can be enabled through the "View" tab at the top left of the screen). You don't need to know how to code in order to do this, as the code that creates the Attributes for each zone should not need to be updated (since this just creates the Attributes and you can customize it manually for each zone through the "Properties" window)
(For your convenience, here is what is contained within that LocalScript:)
---
-- This is an optional resource for adding Attributes to the custom zones
-- Instructions for this can be found in the "Instructions" LocalScript within the "Custom Atmosphere Zones" folder
local function CreateAttributes()
local atmosphereAttributes = {
Density = 0,
Offset = 0,
Color = Color3.fromRGB(255,255,255),
Decay = Color3.fromRGB(255,255,255),
Glare = 0,
Haze = 0
}
for _, container in pairs(workspace.AtmosphereZones:GetChildren()) do
local totalAttributesAdded = 0
for attributeName, defaultValue in pairs(atmosphereAttributes) do
if not container:GetAttribute(attributeName) then
totalAttributesAdded += 1
container:SetAttribute(attributeName, defaultValue)
end
end
warn("Successfully added "..totalAttributesAdded.." Attributes for "..container.Name)
end
end
CreateAttributes()
---
4. Press "Enter" on the keyboard to run the code in the command bar. The "Output" should indicate how many remaining Attributes were added to each of the items
5. After that, every item on the first layer of the "AtmosphereZones" folder will have Attributes / custom properties
---
If you have any additional questions, feel free to ask!
Have you made something similar to this but with changing the density with the dynamic clouds?
If not, maybe that could be planned as a video?
I've briefly looked into the Dynamic Skies / Dynamic Clouds feature but because the feature has not been fully developed to what Roblox Staff had outlined on the feature's announcement / update thread (as of November 22nd, 2022), I haven't considered creating a tutorial about it yet because the feature would probably be subject to further updates. Once it reaches Phase 3 of the roadmap (or once they announce that the feature is fully released) that's when I'd begin to consider creating a video about it.
Feature Announcement / Update Thread: devforum.roblox.com/t/869476
@@Emancyphur oh okay thanks!!
Nice video strong, still waiting for a stream 😞
Well you're in luck because I plan on livestreaming this upcoming weekend! It has been a super long time since the last stream (probably around a year) so it will be interesting to see how many people I still recognize from the streams before
@@Emancyphur is there a time schedule?
@@kev8490 The livestream will most likely be around 12 PM Pacific Time on Saturday, July 30th
I think this is now disabled on mobile or my Roblox client is bugged
It should still work on mobile; for reference, what was your in-game graphics quality set to, and did you notice it not working in your own game or a game created by another developer?
@@Emancyphur it was smh like ,,car licesence test[Voice Chat]"
I had max Graphics, it used to work on My old samsung
Also quick question will you be able to change the timezones of the game whenever you get in the zone?
That would be possible by adding more TweenService-related code to the functions activated by the "localPlayerEntered" & "localPlayerExited" events (at around 10:23 in the video).
An example of that is the following:
local updateTime = TweenService:Create(Lighting, TweenInfo.new(1), {ClockTime = 20})
updateTime:Play()
If you wanted the ClockTime to be updated differently for every single zone you enter, further changes would need to be made to the code, specifically to the way the Atmosphere transition retrieves all the Atmosphere-related Attributes, since adding any Attributes to a zone that correspond with properties of other objects that are not the Atmosphere object would not work with the current set up because we call "container:GetAttributes()" for the Atmosphere transition (which gets all of the Attributes of a zone) meaning it would error if it is told to update a property that the Atmosphere object doesn't have.
Please you can help me I go to make team create I go to permission he call me [Manage collaborator by clicking on the blue button in the top right corner of studio]
If your question is about how to enable Team Create and invite a player to edit a game, I explained that in another tutorial: [ th-cam.com/video/vsHJH2bFn0Q/w-d-xo.html ]. If that doesn't answer your question, please explain your question more clearly so that it is easier to understand what you need help with.
Can we also change Lighting with this?
That would be possible but you'd also need to add more TweenService-related code to the functions activated by the "localPlayerEntered" & "localPlayerExited" events (at around 10:23 in the video).
Here's an example of how that can be achieved for something like changing the ClockTime:
local updateTime = TweenService:Create(Lighting, TweenInfo.new(1), {ClockTime = 20})
updateTime:Play()
If you wanted the ClockTime to be updated differently for every single zone you enter, further changes would need to be made to the code, specifically to the way the Atmosphere transition retrieves all the Atmosphere-related Attributes, since adding any Attributes to a zone that correspond with properties of other objects that are not the Atmosphere object would not work with the current set up. It wouldn't work right away because we call "container:GetAttributes()" for the Atmosphere transition (which gets all of the Attributes of a zone) meaning it would error if it is told to update a property that the Atmosphere object doesn't have.
Unfortunately, I didn't talk much about updating properties of the Lighting Service via a script in this video since the tutorial is based around the Atmosphere object and not Lighting in general. Maybe I'll create another tutorial in the future that explains how to achieve the same effect but with as many properties of the Lighting Service & other relevant Lighting Objects.
My atmosphere it's Red I picked the color red but its won't change and its like a dark and thick atmosphere and you can't see anything.
Do you have a question about why the Atmosphere's color isn't being updated when you set it to Red? Remember that both the "Color" and "Decay" properties change how the Atmosphere appear, so you might need to change both of the properties to make it look how you want.
bro it doesn't working in my game
Are you referring to the Custom Atmosphere Zones not working at all, or something else from the video? As far as I'm aware, nothing has changed with how it works since the video's release. Please check the Output (which can be enabled through the "View" tab at the top left of the screen) to see if there are any errors appearing from the scripts that were shown in the video.
I'd also recommend taking a look at the setup model in the description and comparing the custom zones provided there to see if there's any differences between that and the ones you created. I'd recommend using the custom zones provided (as well as the provided LocalScript for the StarterPlayerScripts in case there are any discrepancies between that and if you wrote it manually while watching the video) so you could modify the custom zones to the desired values to get everything working more quickly.
i changed the size of the part and it stopped working for me, what did i do wrong
If you're talking about the Custom Atmosphere Zones, make sure that Part remained in the "AtmosphereZones" folder (so that the LocalScript will recognize it as a zone) and that it has its "Anchored" property enabled so it doesn't fall into the void. Also ensure that it still has the "CanQuery" property enabled so that the LocalScript will be able to check if the player is standing inside of the zone. Additionally, make sure it still has Attributes (from the process at 5:50 in the video). As long as those aspects of the zone weren't changed prior to updating the size of the part, it should still work as intended.
Hey why did you change your name like 3 time (TH-cam username) sorry if that’s a weird question
If you're talking about my previous TH-cam Channel names that I listed in the "About" section of my channel, those were the main channel names that I had for a few years at a time within the past decade. I started this channel in 2013 and since then, there have been times where I wanted to update the channel name to something cooler / a new name that I liked more. My current channel name of "Emancyphur" will likely be the final name I keep for this channel moving forward.
@@Emancyphur agreed I love that name btw :)
Are you gonna talk about the new roblox materials/pbr update?
I don't have much experience with building, texturing, and how the PBR / Physically-Based Rendering feature works, so it's unlikely that I'll create a video about it. Here are some existing resources about that feature that may be useful for learning more:
Surface Appearance - Roblox Creator Documentation: [ create.roblox.com/docs/building-and-visuals/external-modeling/surface-appearance ]
SurfaceAppearance Announcement Topic - Roblox Developer Forum: [ devforum.roblox.com/t/663449 ]
how do i actually change the day time
You can change the time of day through the "TimeOfDay" property of the "Lighting" Service (briefly shown at 2:27 in the video). If your question is about changing the time of day and the Atmosphere at the same time, then that would be possible but you'd also need to add more TweenService-related code to the functions activated by the "localPlayerEntered" & "localPlayerExited" events (at around 10:23 in the video).
An example of that is the following:
local updateTime = TweenService:Create(Lighting, TweenInfo.new(1), {ClockTime = 20})
updateTime:Play()
If you wanted the ClockTime to be updated differently for every single zone you enter, further changes would need to be made to the code, specifically to the way the Atmosphere transition retrieves all the Atmosphere-related Attributes, since adding any Attributes to a zone that correspond with properties of other objects that are not the Atmosphere object would not work with the current set up because we call "container:GetAttributes()" for the Atmosphere transition (which gets all of the Attributes of a zone) meaning it would error if it is told to update a property that the Atmosphere object doesn't have.
@@Emancyphur thanks
Hey, you probably don't remember me but if you do you'll most likely remember me as øntario (looking back that was kinda a stupid name, considering I don't live anywhere close to the ontario in canada) and I've recently got into scripting, you as one of my biggest inspirations. Is there any way since you cant give a badge locally you can make a script that gives a badge to someone if they say a certain phrase or keyword? Thanks.
- mrlemflem (formerly øntario)
I remember you! If I remember correctly, you used to join the games we'd play during livestreams a few years ago. It's awesome that you are interested in learning about scripting and I'm glad that you returned! To create the feature that you described, we would need to create a server script, then check when a player sends a message through the "player.Chatted" event. We can then check if their message matches up with the keyword, and if it does, we can use the BadgeService to award a badge to the player. Here is an example (and if you have any additional questions, feel free to ask!):
---
local Players = game:GetService("Players")
local BadgeService = game:GetService("BadgeService")
local keyword = "word or phrase the player has to say to receive the badge (preferably all lowercase)"
local badgeID = 1 -- This is the Asset Id of the badge you want to award players when they say the keyword
Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
if string.lower(message) == keyword then
BadgeService:AwardBadge(player.UserId, badgeID)
end
end)
end)
---
Additional Resources:
BadgeService - Roblox Creator Documentation: create.roblox.com/docs/reference/engine/classes/BadgeService
player.Chatted Event - Roblox Creator Documentation: create.roblox.com/docs/reference/engine/classes/Player#Chatted
@@Emancyphur Yes! One I vividly remember was the bloxy awards and I think one of the egg hunts (I'm not sure), and thanks for the script! ill try to tune in if I need any more help
and i've learned alot in tutorials, one guy i saw a comment of said this really smart thing that was something like
"Dont just rush to finish tutorials, try to learn from them." And ill certainly try to learn from this.
Edit: It works! thank you so much.
@@mrlemflem Yeah the Bloxy Awards and the unofficial Egg Hunt livestreams were super fun! To answer your question, the script could be placed in the ServerScriptService. Most server scripts end up being placed there since it's one of the primary containers where the code within the script is allowed to run. Its placement in the game really depends on its purpose for the game / what it does; if it was for the functionality of a Tool, such as a skateboard or a sword, it is more likely that the server script would be placed in the Tool rather than the ServerScriptService.
Additional Resources:
ServerScriptService - Roblox Creator Documentation: create.roblox.com/docs/reference/engine/classes/ServerScriptService
Script - Roblox Creator Documentation: create.roblox.com/docs/reference/engine/classes/Script
doesent work for me, i followed the tutorial tho
Are you referring to the Custom Atmosphere Zones not working at all, or something else from the video? As far as I'm aware, nothing has changed with how it works since the video's release. Please check the Output to see if there are any errors occurring related to the scripts from the video. I'd also recommend taking a look at the setup model in the description and comparing the custom zones provided there to see if there's any differences between that and the ones you created. I'd recommend using the custom zones provided (as well as the provided LocalScript for the StarterPlayerScripts in case there are any discrepancies between that and if you wrote it manually while watching the video) so you could modify the custom zones to the desired values to get everything working more quickly.
@@Emancyphur Any way yo share my place with you? Its mine and my friends and im new to scripting but good enough to know whats going on, no error message just nothing changes when i enter
@@Emancyphurhello?
@@snowee5982 If you want to, you can. If it's a group game I'd need to join the group but if it's on an individual profile, I'd just need to temporarily send a friend request and you could invite me to it (more info about that process is here: create.roblox.com/docs/projects/collaboration ). However, I could still try to help you figure out what might be happening without needing to do that. For reference, did you already try to use the pre-made custom zones model that was provided in the description (which has written instructions)?
@@Emancyphur sorry im so late, its late for me so i have to go we can contact tommorow ok
old script? isnt working.
Are you referring to the custom atmosphere zones not working or one of the example scripts from earlier in the video? If the former, the Custom Atmosphere Zones still work in the same way as it was shown in the video (if you move everything from the folders in the Atmosphere Resources into the designated spots, it should work with the provided resources right away). For the LocalScript, did you write it manually while watching the video or did you use the one provided with the model in the description? Are any errors appearing in the Output when playtesting?
@@Emancyphur did everything the video said
@@touseey Are any errors appearing in the Output when playtesting? Here's an example video I recorded just now in a fresh Baseplate template showcasing that it still works: th-cam.com/video/K1EQYOoFDMs/w-d-xo.html
@@Emancyphur got it to work, thanks!
Your atmosphere resources are complicated! make a STEP by STEP im so dissapointed in myself because i cant even get what your saying since im new to studio!!
There are already step-by-step written instructions provided in the Atmosphere Resources model (to be specific, it can be found in the LocalScript called "Instructions" within the "Custom Atmosphere Zones" folder) that explains where everything needs to be placed, what objects need to be created / modified, etc. If you have any specific questions about the step-by-step process, feel free to ask since I don't know which part of the process you want help with. As of November 23rd, 2023, here are the written instructions provided with the model:
1. Open the folders called "ReplicatedStorage Items", "StarterPlayerScripts Items", and "Workspace Items"
2. Move the "Zone" ModuleScript into the "ReplicatedStorage" Service
3. Move the "LightingZone" LocalScript into the "StarterPlayerScripts" folder (which can be found through the "StarterPlayer" Service)
4. Move the "AtmosphereZones" folder into the Workspace
5. Add a "Sky" and "Atmosphere" object into the "Lighting" Service if there aren't ones there already.
(Select the plus button next to the Lighting Service, then click "Sky". Follow the same process for the "Atmosphere" object)
6. Customize the properties of the Atmosphere to create your desired "default" Atmosphere, which is what the Atmosphere will look like when a player is not standing in any custom zone.
7. Use parts to create zones / regions that the player needs to walk into for the Atmosphere to be updated.
(Included in the AtmosphereZones folder are a few examples of custom zones)
----
Requirements for the custom zone to work:
a. A zone can be made of a single part, or multiple parts can be placed into an object that isn't a part, such as a Model or a Folder. Examples of this are included in the "AtmosphereZones" folder.
b. Parts that are contained within other parts will not be included in the custom zone (see the "Blue Zone" in the AtmosphereZones folder as an example).
c. The "CanCollide" property of the parts must be set to false (unchecked box). This is because by default, players must be standing inside of a part within the zone to activate the intended effects.
(It is also recommended to enable the "Anchored" property and set the "Transparency" property to 1 for each part that makes up the zone so the player's view is not blocked by the parts).
d. The "CanQuery" property of the parts must be set to true (checked box). Without this, the ZonePlus module will not be able to detect when a player enters or exits the part(s).
----
8. Open the "AtmosphereZones" folder for the final steps. We need to add Attributes to each of the zones so the "LightingZone" LocalScript knows what the Atmosphere should look like when a player enters a zone
----
There are two options for adding Attributes to the zones
Automatic Option:
a1. Open the "Adding Attributes Code" folder.
a2. Open the "Attributes Command Bar Code" LocalScript.
a3. Copy and paste the code from the LocalScript into Roblox Studio's Command Bar at the bottom of the screen (this can be enabled through the "View" tab at the top left of the screen)
a4. Press "Enter" on the keyboard to run the code in the command bar. The "Output" should indicate how many remaining Attributes were added to each of the items
a5. After that, every item on the first layer of the "AtmosphereZones" folder will have Attributes / custom properties
Manual Option:
b1. Select each zone in the "AtmosphereZones" folder
(Reminder: You can select multiple parts at the same time by holding the Control [Ctrl] or Command [Cmd] key and selecting each part. This allows you to apply the same Attributes to all of the selected items at once)
b2. Navigate to the "Properties" widget (which can be enabled through the "View" tab at the top left of the screen)
b3. Look for the "Attributes" category
b4. Select "Add Attribute"
b5. Set the name of the Attribute to the exact same name of one of the Atmosphere object's properties. The "type" is the type of value that the property is (examples are included below).
b6. Repeat the previous step for every property of the Atmosphere object.
Here is a list of the Atmosphere object's properties and the types of values:
Density - number
Offset - number
Glare - number
Haze - number
Color - Color3
Decay - Color3
----
9. Customize the Attributes (by selecting the zone, navigating to the "Properties" widget, looking for the "Attributes" category, then selecting the box to the right of the Attribute where it shows a value of [255, 255, 255] or 0 by default) to the settings that you want the Atmosphere to have when the player enters the zone
(Reminder: The example AtmosphereZones that were provided with this model already have customized Attributes as a point of reference)
10. To make it easier, customize the properties of an "Atmosphere" object in the "Lighting" Service to what you want the Atmosphere to look like
11. Then, copy the values of each property of the Atmosphere and paste it into the value of the Attribute that has the same name.
12. After that, the custom Atmosphere zones should be complete!
NO WAY YOU HELped ME
these vids are the best even I have more subs
didnt work
Are you referring to the Custom Atmosphere Zones not working at all, or something else from the video? As far as I'm aware, nothing has changed with how it works since the video's release. Please check the Output to see if there are any errors occurring related to the scripts from the video. I'd also recommend taking a look at the setup model in the description and comparing the custom zones provided there to see if there's any differences between that and the ones you created. I'd recommend using the custom zones provided (as well as the provided LocalScript for the StarterPlayerScripts in case there are any discrepancies between that and if you wrote it manually while watching the video) so you could modify the custom zones to the desired values to get everything working more quickly.
much helpful much wow i will try it@@Emancyphur
hi
c'est l'epico
complex af
If you have questions about something from the tutorial you can ask and I'll try to explain it in a simpler way
How do you make it to where you can also add certain skyboxes for certain regions? Also Great video and very informative and easy to understand!
Ahhh, I'm super sorry about the really late response! I was going to go into Roblox Studio and write some example code to answer your question but I kept getting distracted by other things and eventually forgot to respond. To answer your question, it would be possible to have separate skyboxes for different zones, however, it would not be able to have a smooth transition because the type of most of the properties that the "Sky" object has are not on the list of property types that the TweenService is able to update: ( create.roblox.com/docs/reference/engine/classes/TweenService ).
There's a few things that would need to be updated for skyboxes to be integrated into the system, starting with finding a way to define what skybox will be used for each zone. The simplest way of achieving this would likely start with adding the Sky object directly into the zone within the "AtmosphereZones" folder. Additionally, make sure *that a copy of the original skybox (the one that should be visible when the player is not in any custom zones) is kept in a spot that is easy for the LocalScript to reference so that the LocalScript will be able to change it back when the player exits a custom zone. For this example, I'll keep it directly in the ReplicatedStorage and it'll be called "OriginalSkybox".
Next, the sections of code that would need to be updated in the LocalScript are above and within the functions activated from the "localPlayerEntered" & "localPlayerExited" events (pause the video at around 10:55 to see where this new code would go in relation to the existing code). The main purpose of the changes will be to check if the custom zone that the player has entered has a skybox, and if so, we'll loop through all of its properties and then replace the current skybox's properties with the brand new one. If you need any additional clarification about how the code works, feel free to ask! Here's what the brand new code would look like (starting from right before the "CreateZone" function all the way until the point where the changes to the code end):
---
local function UpdateSkybox(newSkybox)
local currentSkybox = Lighting.Sky
local skyboxProperties = {
CelestialBodiesShown = newSkybox.CelestialBodiesShown,
MoonAngularSize = newSkybox.MoonAngularSize,
MoonTextureId = newSkybox.MoonTextureId,
SkyboxBk = newSkybox.SkyboxBk,
SkyboxDn = newSkybox.SkyboxDn,
SkyboxFt = newSkybox.SkyboxFt,
SkyboxLf = newSkybox.SkyboxLf,
SkyboxRt = newSkybox.SkyboxRt,
SkyboxUp = newSkybox.SkyboxUp,
StarCount = newSkybox.StarCount,
SunAngularSize = newSkybox.SunAngularSize,
SunTextureId = newSkybox.SunTextureId,
}
for propertyName, newValue in skyboxProperties do
currentSkybox[propertyName] = newValue
end
end
local function CreateZone(container)
local customZone = Zone.new(container)
customZone:bindToGroup("EnterOnlyOneZoneAtATime")
customZone.localPlayerEntered:Connect(function()
local skyboxCheck = container:FindFirstChildOfClass("Sky")
if skyboxCheck then
UpdateSkybox(skyboxCheck)
end
local transition = TweenService:Create(Atmosphere, TweenInfo.new(1), container:GetAttributes())
transition:Play()
end)
customZone.localPlayerExited:Connect(function()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local originalSkybox = ReplicatedStorage.OriginalSkybox -- This and the line of code above could be added to the top of the LocalScript if you'd like
UpdateSkybox(originalSkybox)
local transition = TweenService:Create(Atmosphere, TweenInfo.new(1), defaultAtmosphere)
transition:Play()
end)
---
Sorry that this wasn't included in the original tutorial; I didn't address Skyboxes or the properties of the Lighting Service since this tutorial was based around the Atmosphere object and not Lighting in general. Maybe I'll create another tutorial in the future that explains how to achieve the same effect but with the properties of the Lighting Service & other relevant Lighting Objects, but for now, I hope this comment was useful! If you have any additional questions, feel free to ask.