├── README.md ├── Roblox Studio Tutorial Series └── 1-100 │ ├── 1-10 │ ├── Episode 1 - Adding Teams, Spawnpoints, & Spawning with Tools │ │ └── Source Code.lua │ ├── Episode 2 - Team Change GUI │ │ └── Source Code.lua │ ├── Episode 3 - Future Is Bright Phase 2.5 (Jailbreak Lighting) │ │ └── Not Applicable │ ├── Episode 4 - Jailbreak Prison Escape Script │ │ ├── Auto Team Change Tutorial Model.rbxm │ │ └── Source Code.lua │ ├── Episode 5 - Premium Payouts Guide │ │ └── Source Code.lua │ ├── Episode 6 - Avoiding Game DELETION & Account TERMINATION │ │ └── Not Applicable │ ├── Episode 7 - Team Create & Collaborative Editing Guide │ │ └── Not Applicable │ ├── Episode 8 - Teleporter Creation & Customization │ │ └── Source Code.lua │ ├── Episode 9 - Depth of Field │ │ └── Source Code.lua │ └── [Last] Episode 10 - Atmosphere │ │ ├── Attributes Command Bar Code.lua │ │ ├── Episode 10 - Atmosphere Resources.rbxm │ │ ├── LightingZone LocalScript.lua │ │ └── Scripting Examples.lua │ ├── 11-20 │ ├── Episode 11 - Reverting Updates │ │ └── Not Applicable │ ├── Episode 12 - Group, Team, & Player-Only Doors │ │ └── Source Code.lua │ ├── Episode 13 - Team Custom Characters │ │ ├── Source Code (Multiple Characters per Team).lua │ │ ├── Source Code (One Character per Team).lua │ │ └── Team Custom Characters System.rbxm │ ├── Episode 14 - Weapon Holstering (Wearable Tools) │ │ ├── Item Holstering System.rbxm │ │ └── Source Code.lua │ ├── Episode 15 - Dynamic Team Loadouts │ │ ├── Dynamic Team Loadouts.rbxm │ │ └── Source Code.lua │ ├── Episode 16 - Freecam │ │ ├── Custom Freecam Access.lua │ │ ├── Episode 16 - Freecam Resources.rbxm │ │ └── Permanently Disable Freecam.lua │ ├── Episode 17 - Spawning with Custom Hats │ │ └── Source Code.lua │ ├── Episode 18 - Team-Only GUIs │ │ ├── Source Code.lua │ │ └── Team-Only GUIs.rbxm │ ├── Episode 19 - Roblox Creator Documentation Hub Resources │ │ └── Source Code.lua │ └── [Last] Episode 20 - Future Is Bright Phase 3.0 │ │ └── Not Applicable │ ├── 21-30 │ ├── Episode 21 - Team-Only Animations │ │ └── Source Code.lua │ ├── Episode 22 - How To Fix Your Game │ │ └── Source Code.lua │ ├── Episode 23 - Loadout (Class) Selection System │ │ ├── Loadout Selection System.rbxm │ │ ├── Source Code (Player-Customizable Loadouts).lua │ │ └── Source Code (Preset Loadouts).lua │ ├── Episode 24 - Custom Chat Tags & More │ │ └── Source Code.lua │ ├── Episode 25 - Click To Equip Item │ │ ├── Click to Equip Hat, Clothing, & Tools.rbxm │ │ ├── Source Code (Equip Clothing).lua │ │ ├── Source Code (Hats [Accessories]).lua │ │ └── Source Code (Tools).lua │ ├── Episode 26 - Effect Bricks │ │ └── Source Code.lua │ ├── Episode 27 - Keyword Voice Chat │ │ └── Source Code.lua │ ├── Episode 28 - Disabling Health Regeneration │ │ └── Source Code.lua │ ├── Episode 29 - Custom Health Bar │ │ ├── Custom Health Bar Model.rbxm │ │ └── Source Code.lua │ └── [Last] Episode 30 - Friend Join Notification │ │ ├── Friend Join Notification LocalScript.rbxm │ │ └── Source Code.lua │ ├── 31-40 │ ├── Episode 31 - Creating Accessories from models, parts, & meshes │ │ ├── Source Code (Automatic Welding).lua │ │ ├── Source Code (Basic Examples).lua │ │ ├── Source Code (CollectionService Examples).lua │ │ ├── Source Code (Loops Example).lua │ │ └── Welding & Accessory Resources.rbxm │ ├── Episode 32 - How to enable the Surface Tool │ │ └── Not Applicable │ ├── Episode 33 │ │ └── Source Code.lua │ ├── Episode 34 │ │ └── Source Code.lua │ ├── Episode 35 │ │ └── Source Code.lua │ ├── Episode 36 │ │ └── Source Code.lua │ ├── Episode 37 │ │ └── Source Code.lua │ ├── Episode 38 │ │ └── Source Code.lua │ ├── Episode 39 │ │ └── Source Code.lua │ └── [Last] Episode 40 │ │ └── Source Code.lua │ ├── 41-50 │ ├── Episode 41 │ │ └── Source Code.lua │ ├── Episode 42 │ │ └── Source Code.lua │ ├── Episode 43 │ │ └── Source Code.lua │ ├── Episode 44 │ │ └── Source Code.lua │ ├── Episode 45 │ │ └── Source Code.lua │ ├── Episode 46 │ │ └── Source Code.lua │ ├── Episode 47 │ │ └── Source Code.lua │ ├── Episode 48 │ │ └── Source Code.lua │ ├── Episode 49 │ │ └── Source Code.lua │ └── [Last] Episode 50 │ │ └── Source Code.lua │ └── All of the Source Code is in Lua!.lua └── Scripting Solutions └── 1-10 └── Episode 1 - 'X is not a valid member of Y' error (Practice Problems) ├── Instructions - Setting up the Practice Problems.lua ├── Practice Problem #1.lua ├── Practice Problem #2.lua ├── Practice Problem #3.lua ├── Practice Problem #4.lua ├── Practice Problem #5.lua └── Scripting Solutions Episode 1 - Practice Problems.rbxm /README.md: -------------------------------------------------------------------------------- 1 | # Roblox-Studio-Tutorials 2 | This contains the source code for scripts from the [Roblox Studio Tutorial Series](https://www.youtube.com/playlist?list=PLib8lkKsQ4i4Ik77nxD78NfMoeUoS_9w7) and the [Scripting Solutions](https://www.youtube.com/playlist?list=PLib8lkKsQ4i6j_3D7e5KI6kvBupf4ZtYm) tutorial series on the [Emancyphur](https://www.youtube.com/Emancyphur) YouTube Channel, in addition to tutorial setup models (in `rbxm` files) that can be imported into Roblox Studio. 3 | 4 | This repository will be updated semi-regularly (around the release of each tutorial). 5 | 6 | --- 7 | 8 | ## Navigation 9 | 10 | In order to find what you need, open up one of the folders above. The "Roblox Studio Tutorial Series" folder is for all tutorials from [this playlist of the same name](https://www.youtube.com/playlist?list=PLib8lkKsQ4i4Ik77nxD78NfMoeUoS_9w7). The folders are categorized by Episode number -- the folder "Episodes 1-100" will have subfolders that contain resources from Episodes 1-10, 11-20, 21-30, etc. 11 | 12 | After opening up one of the subfolders, you'll be presented with folders that have the name of a tutorial. These will contain source code/model download files related to that tutorial when applicable. In order to import the model into Roblox Studio (optional), right click in the Explorer, click on "Insert From File", then select and open the rbxm file. 13 | 14 | --- 15 | 16 | ## Questions / Feedback 17 | 18 | If you have questions or feedback related to this GitHub Repository, please let me know by either creating a thread in this repository's "Discussions" section, posting a comment on one of my videos, messaging me on the Roblox Developer Forum, or posting it in the "youtube-main" forum of the "Emancyphur Community Server". 19 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/1-10/Episode 1 - Adding Teams, Spawnpoints, & Spawning with Tools/Source Code.lua: -------------------------------------------------------------------------------- 1 | -- No scripts were provided for Episode 1 of the Roblox Studio Tutorial Series. 2 | 3 | -- The only code that was used during the video is related to adding a gear into your game from the Avatar Shop using the InsertService 4 | game:GetService("InsertService"):LoadAsset(1).Parent = workspace 5 | --[[ The number 1 is replaced with the ID of an item in Roblox's Avatar Shop (the number in the web address bar) 6 | and the code is input to the command bar in Roblox Studio. After clicking enter, the item will be added to the Workspace, contained in a Model --]] 7 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/1-10/Episode 2 - Team Change GUI/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/1-10/Episode 3 - Future Is Bright Phase 2.5 (Jailbreak Lighting)/Not Applicable: -------------------------------------------------------------------------------- 1 | No scripts were provided for Episode 3 of the Roblox Studio Tutorial Series. 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/1-10/Episode 4 - Jailbreak Prison Escape Script/Auto Team Change Tutorial Model.rbxm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emancyphur/Roblox-Studio-Tutorials/c44d9c6a09ed5c31c32beacbc0309545b34eb368/Roblox Studio Tutorial Series/1-100/1-10/Episode 4 - Jailbreak Prison Escape Script/Auto Team Change Tutorial Model.rbxm -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/1-10/Episode 4 - Jailbreak Prison Escape Script/Source Code.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Episode 4 - Jailbreak Prison Escape Script 4 | Tutorial Link: ( https://youtu.be/5DaDfDkKRyo ) 5 | 6 | This is the non-annotated version of the script. 7 | For comments that explain every line, please refer to the "Auto Team Change Tutorial Model.rbxm" file in the folder that contains this Source Code 8 | 9 | ]]-- 10 | 11 | ------ Server Script ------ 12 | 13 | local Players = game:GetService("Players") 14 | 15 | local Teams = game:GetService("Teams") 16 | local Prisoner = Teams.Prisoner 17 | local Criminal = Teams.Criminal 18 | 19 | local EscapeBrick = script.Parent 20 | 21 | EscapeBrick.Touched:Connect(function(touch) 22 | 23 | local player = Players:GetPlayerFromCharacter(touch.Parent) 24 | 25 | if player then 26 | if player.Team == Prisoner then 27 | player.Team = Criminal 28 | end 29 | end 30 | end) 31 | 32 | --[[ 33 | This is Episode 4 of the tutorial series that teaches you ROBLOX Studio fundamentals! 34 | 35 | The full list of instructional scripts from this series can be 36 | found through the ROBLOX group that posted this model. 37 | ]]-- 38 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/1-10/Episode 5 - Premium Payouts Guide/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/1-10/Episode 6 - Avoiding Game DELETION & Account TERMINATION/Not Applicable: -------------------------------------------------------------------------------- 1 | No scripts were provided for Episode 6 of the Roblox Studio Tutorial Series. 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/1-10/Episode 7 - Team Create & Collaborative Editing Guide/Not Applicable: -------------------------------------------------------------------------------- 1 | No scripts were provided for Episode 7 of the Roblox Studio Tutorial Series. 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/1-10/Episode 8 - Teleporter Creation & Customization/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/1-10/Episode 9 - Depth of Field/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/1-10/[Last] Episode 10 - Atmosphere/Attributes Command Bar Code.lua: -------------------------------------------------------------------------------- 1 | -- This is an optional resource for adding Attributes to the custom zones 2 | -- Instructions for this and creating the custom zones can be found in the "Instructions" LocalScript within the "Custom Atmosphere Zones" folder from the "Atmosphere Resources" model file 3 | 4 | local function CreateAttributes() 5 | local atmosphereAttributes = { 6 | Density = 0, 7 | Offset = 0, 8 | Color = Color3.fromRGB(255,255,255), 9 | Decay = Color3.fromRGB(255,255,255), 10 | Glare = 0, 11 | Haze = 0 12 | } 13 | 14 | for _, container in pairs(workspace.AtmosphereZones:GetChildren()) do 15 | 16 | local totalAttributesAdded = 0 17 | 18 | for attributeName, defaultValue in pairs(atmosphereAttributes) do 19 | 20 | if not container:GetAttribute(attributeName) then 21 | totalAttributesAdded += 1 22 | container:SetAttribute(attributeName, defaultValue) 23 | end 24 | end 25 | 26 | warn("Successfully added "..totalAttributesAdded.." Attributes for "..container.Name) 27 | end 28 | end 29 | CreateAttributes() 30 | 31 | --[[ 32 | 33 | This is Episode 10 of Emancyphur's Roblox Studio Tutorial Series! 34 | 35 | The full list of instructional scripts from this series can be 36 | found through this GitHub Repository. 37 | 38 | ]]-- 39 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/1-10/[Last] Episode 10 - Atmosphere/Episode 10 - Atmosphere Resources.rbxm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emancyphur/Roblox-Studio-Tutorials/c44d9c6a09ed5c31c32beacbc0309545b34eb368/Roblox Studio Tutorial Series/1-100/1-10/[Last] Episode 10 - Atmosphere/Episode 10 - Atmosphere Resources.rbxm -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/1-10/[Last] Episode 10 - Atmosphere/LightingZone LocalScript.lua: -------------------------------------------------------------------------------- 1 | local ReplicatedStorage = game:GetService("ReplicatedStorage") 2 | local Lighting = game:GetService("Lighting") 3 | local TweenService = game:GetService("TweenService") 4 | 5 | local Zone = require(ReplicatedStorage.Zone) 6 | 7 | if not Lighting:FindFirstChildOfClass("Atmosphere") then 8 | warn("There wasn't an Atmosphere object in the Lighting! Creating a new one...") 9 | local newAtmosphere = Instance.new("Atmosphere") 10 | newAtmosphere.Name = "Atmosphere" 11 | newAtmosphere.Parent = Lighting 12 | end 13 | 14 | local Atmosphere = Lighting.Atmosphere 15 | local atmosphereZones = workspace.AtmosphereZones 16 | 17 | 18 | local defaultAtmosphere = { 19 | Density = Atmosphere.Density, 20 | Offset = Atmosphere.Offset, 21 | Color = Atmosphere.Color, 22 | Decay = Atmosphere.Decay, 23 | Glare = Atmosphere.Glare, 24 | Haze = Atmosphere.Haze 25 | } 26 | 27 | 28 | local function CreateZone(container) 29 | local customZone = Zone.new(container) 30 | customZone:bindToGroup("EnterOnlyOneZoneAtATime") 31 | 32 | customZone.localPlayerEntered:Connect(function() 33 | local transition = TweenService:Create(Atmosphere, TweenInfo.new(1), container:GetAttributes()) 34 | transition:Play() 35 | end) 36 | 37 | customZone.localPlayerExited:Connect(function() 38 | local transition = TweenService:Create(Atmosphere, TweenInfo.new(1), defaultAtmosphere) 39 | transition:Play() 40 | end) 41 | 42 | 43 | local connection 44 | 45 | local function DestroyZone() 46 | customZone:unbindFromGroup("EnterOnlyOneZoneAtATime") 47 | customZone:destroy() 48 | 49 | connection:Disconnect() 50 | connection = nil 51 | end 52 | 53 | connection = container.AncestryChanged:Connect(function() 54 | if container.Parent ~= atmosphereZones then 55 | DestroyZone() 56 | end 57 | end) 58 | 59 | container.Destroying:Connect(DestroyZone) 60 | end 61 | 62 | 63 | for _, container in ipairs(atmosphereZones:GetChildren()) do 64 | CreateZone(container) 65 | end 66 | 67 | atmosphereZones.ChildAdded:Connect(CreateZone) 68 | 69 | --[[ 70 | 71 | This is Episode 10 of Emancyphur's Roblox Studio Tutorial Series! 72 | 73 | The full list of instructional scripts from this series can be 74 | found through this GitHub Repository. 75 | 76 | ]]-- 77 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/1-10/[Last] Episode 10 - Atmosphere/Scripting Examples.lua: -------------------------------------------------------------------------------- 1 | -- These are the general examples for updating the Atmosphere object through scripting 2 | 3 | -- Server Script Example 4 | local Lighting = game:GetService("Lighting") 5 | local Atmosphere = Lighting:FindFirstChild("Atmosphere") 6 | 7 | Atmosphere.Density = 0.433 8 | Atmosphere.Offset = 0 9 | Atmosphere.Glare = 6.5 10 | Atmosphere.Haze = 2.56 11 | Atmosphere.Color = Color3.fromRGB(85, 85, 127) 12 | Atmosphere.Decay = Color3.fromRGB(76, 89, 92) 13 | 14 | 15 | 16 | 17 | -- ProximityPrompt Example 18 | local Lighting = game:GetService("Lighting") 19 | local Atmosphere = Lighting:FindFirstChild("Atmosphere") 20 | 21 | local ProximityPrompt = script.Parent 22 | ProximityPrompt.TriggerEnded:Connect(function() 23 | Atmosphere.Density = 0.433 24 | Atmosphere.Offset = 0 25 | Atmosphere.Glare = 6.5 26 | Atmosphere.Haze = 2.56 27 | Atmosphere.Color = Color3.fromRGB(85, 85, 127) 28 | Atmosphere.Decay = Color3.fromRGB(76, 89, 92) 29 | end) 30 | 31 | 32 | 33 | 34 | -- LocalScript Example #1 (StarterPlayerScripts folder) 35 | local Lighting = game:GetService("Lighting") 36 | local Atmosphere = Lighting:FindFirstChild("Atmosphere") 37 | 38 | Atmosphere.Density = 0.643 39 | Atmosphere.Offset = 0 40 | Atmosphere.Glare = 2.44 41 | Atmosphere.Haze = 2.56 42 | Atmosphere.Color = Color3.fromRGB(0, 0, 0) 43 | Atmosphere.Decay = Color3.fromRGB(85, 85, 127) 44 | 45 | 46 | 47 | 48 | -- LocalScript Example #2 (StarterPlayerScripts folder) 49 | local Lighting = game:GetService("Lighting") 50 | local Atmosphere = Lighting:FindFirstChild("Atmosphere") 51 | 52 | local randomNumber = math.random(1, 100) 53 | 54 | if randomNumber == 50 then -- This updates the Atmosphere only if the randomly selected number is 50 55 | Atmosphere.Density = 0.643 56 | Atmosphere.Offset = 0 57 | Atmosphere.Glare = 2.44 58 | Atmosphere.Haze = 2.56 59 | Atmosphere.Color = Color3.fromRGB(0, 0, 0) 60 | Atmosphere.Decay = Color3.fromRGB(85, 85, 127) 61 | end 62 | 63 | --[[ 64 | 65 | This is Episode 10 of Emancyphur's Roblox Studio Tutorial Series! 66 | 67 | The full list of instructional scripts from this series can be 68 | found through this GitHub Repository. 69 | 70 | ]]-- 71 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/11-20/Episode 11 - Reverting Updates/Not Applicable: -------------------------------------------------------------------------------- 1 | No scripts were provided for Episode 11 of the Roblox Studio Tutorial Series. 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/11-20/Episode 12 - Group, Team, & Player-Only Doors/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/11-20/Episode 13 - Team Custom Characters/Source Code (Multiple Characters per Team).lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Episode 13 - Team Custom Characters System 4 | Tutorial Link: ( https://youtu.be/dkXCWZdZR-s ) 5 | 6 | This is the non-annotated version of the script. 7 | For comments that explain every line, please refer to the "Team Custom Characters System.rbxm" file in the folder that contains this Source Code 8 | 9 | ]]-- 10 | 11 | ------ Server Script ------ 12 | 13 | local Players = game:GetService("Players") 14 | local Teams = game:GetService("Teams") 15 | 16 | local ServerStorage = game:GetService("ServerStorage") 17 | local TeamCharacters = ServerStorage:WaitForChild("Multiple TeamCharacters") 18 | 19 | local RespawnDelay = 2.5 20 | 21 | local RespawnConnections = {} 22 | local CharacterPositions = {} 23 | local RigTypes = {} 24 | 25 | Players.CharacterAutoLoads = false 26 | 27 | local FirstSpawn = {} 28 | 29 | 30 | local function AnimatorCreator() 31 | 32 | for i,Character in pairs(TeamCharacters:GetDescendants()) do 33 | 34 | if Character:IsA("Model") then 35 | 36 | local Humanoid = Character:FindFirstChildOfClass("Humanoid") 37 | 38 | if not Humanoid then 39 | 40 | local NewHumanoid = Instance.new("Humanoid") 41 | NewHumanoid.Name = "Humanoid" 42 | NewHumanoid.RigType = Enum.HumanoidRigType.R15 43 | NewHumanoid.Parent = Character 44 | warn("A Humanoid object has been created for "..Character.Name..". An R15 Humanoid was added by default. \nIf you are using an R6 Character, please manually add one into the Custom Character while editing, then select it, go into its Properties, and change 'RigType' to R6") 45 | 46 | Humanoid = Character:FindFirstChildOfClass("Humanoid") 47 | end 48 | 49 | if Humanoid and not Humanoid:FindFirstChild("Animator") then 50 | warn("No Animator object in Humanoid for "..Character.Name.." -- creating one so Animations replicate to server") 51 | 52 | local AnimateLocalScript = Character:FindFirstChild("Animate") 53 | 54 | if not AnimateLocalScript then warn("No Animate LocalScript detected for "..Character.Name.." please add one for this Character so that it will have proper Animations") 55 | 56 | elseif AnimateLocalScript then 57 | 58 | local Animator = Instance.new("Animator") 59 | Animator.Parent = Humanoid 60 | end 61 | end 62 | end 63 | end 64 | end 65 | 66 | AnimatorCreator() 67 | TeamCharacters.DescendantAdded:Connect(function(Item) 68 | if Item:IsA("Model") then 69 | AnimatorCreator() 70 | end 71 | end) 72 | 73 | 74 | 75 | 76 | 77 | local function RespawnPlayer(player,LoadCharacter) 78 | 79 | if RespawnConnections[player] then 80 | RespawnConnections[player]:Disconnect() 81 | RespawnConnections[player] = nil 82 | end 83 | 84 | if LoadCharacter then 85 | wait(RespawnDelay) 86 | LoadCharacter(player) 87 | end 88 | end 89 | 90 | 91 | 92 | 93 | 94 | local function LoadCharacter(player,NewTeam) 95 | 96 | if RigTypes[player] == nil then 97 | print("No RigType available") 98 | 99 | player:LoadCharacter() 100 | 101 | local Character = player.Character or player.CharacterAdded:Wait() 102 | local Humanoid = Character:WaitForChild("Humanoid") 103 | local RigType = Humanoid.RigType == Enum.HumanoidRigType.R15 and "R15" or "R6" 104 | 105 | RigTypes[player] = RigType 106 | LoadCharacter(player) 107 | 108 | elseif RigTypes[player] ~= nil then 109 | 110 | if player.Neutral == true or not player.Team then player:LoadCharacter() warn(player.Name.." does not have a team/has the 'Neutral' property set to true.\nThe player.Neutral property must be set to false and the player needs a team to be spawned in as a custom character") 111 | 112 | elseif player.Team and player.Neutral == false then 113 | 114 | local RigType = RigTypes[player] 115 | 116 | local FindTeamCharacterFolder = TeamCharacters:FindFirstChild(player.Team.Name..RigType) 117 | 118 | if not FindTeamCharacterFolder then player:LoadCharacter() warn("No TeamCharacters Folder found for "..player.Team.Name) 119 | 120 | elseif FindTeamCharacterFolder then 121 | 122 | local CharacterFolder = FindTeamCharacterFolder:GetChildren() 123 | local FindTeamCharacter = CharacterFolder[math.random(1,#CharacterFolder)] 124 | 125 | if FindTeamCharacter and NewTeam ~= true then 126 | 127 | print("Teamcharacter found for "..player.Name.." on "..player.Team.Name) 128 | 129 | local NewCharacter = FindTeamCharacter:Clone() 130 | 131 | NewCharacter.Name = player.Name 132 | player.Character = NewCharacter 133 | ------------------------------------------------------------------------------------------- 134 | local SpawnpointsFolder = workspace:FindFirstChild(player.Team.Name.."Spawnpoints") 135 | 136 | if not SpawnpointsFolder then warn("No spawnpoints folder found for "..player.Team.Name..", please follow the instructions around line 90 of the script to resolve this") 137 | 138 | elseif SpawnpointsFolder then 139 | 140 | local Spawnpoints = SpawnpointsFolder:GetChildren() 141 | local RandomSpawn = Spawnpoints[math.random(1,#Spawnpoints)] 142 | warn(RandomSpawn) 143 | 144 | if RandomSpawn.Position ~= nil then 145 | player.Character:SetPrimaryPartCFrame(RandomSpawn.CFrame + Vector3.new(0,2,0)) 146 | end 147 | end 148 | ------------------------------------------------------------------------------------------- 149 | NewCharacter.Parent = game.Workspace 150 | 151 | if FirstSpawn[player] == true and RigTypes[player] == "R6" then 152 | FirstSpawn[player] = nil 153 | 154 | wait(1) 155 | 156 | LoadCharacter(player) 157 | end 158 | 159 | 160 | elseif FindTeamCharacter and NewTeam == true then 161 | 162 | print("Teamcharacter found for "..player.Name.." on "..player.Team.Name) 163 | 164 | CharacterPositions[player] = player.Character:FindFirstChild("HumanoidRootPart").CFrame 165 | 166 | local NewCharacter = FindTeamCharacter:Clone() 167 | 168 | NewCharacter.Name = player.Name 169 | player.Character = NewCharacter 170 | player.Character:WaitForChild("HumanoidRootPart").CFrame = CharacterPositions[player] 171 | NewCharacter.Parent = game.Workspace 172 | 173 | if FirstSpawn[player] == true and RigTypes[player] == "R6" then 174 | FirstSpawn[player] = nil 175 | 176 | wait(1) 177 | 178 | LoadCharacter(player) 179 | end 180 | 181 | else player:LoadCharacter() print("No Teamcharacter found for "..player.Name.." on "..player.Team.Name) 182 | 183 | end 184 | end 185 | end 186 | end 187 | 188 | local Character = player.Character or player.CharacterAdded:Wait() 189 | local Humanoid = Character:FindFirstChild("Humanoid") 190 | RespawnConnections[player] = Humanoid.Died:Connect(function() 191 | RespawnPlayer(player, LoadCharacter) 192 | end) 193 | end 194 | 195 | 196 | 197 | 198 | 199 | for i,Team in pairs(Teams:GetTeams()) do 200 | Team.PlayerAdded:Connect(function(player) 201 | 202 | if not RigTypes[player] then 203 | warn("No RigType found for a player! The FirstCharacterLoad function needs to finish its task") 204 | 205 | elseif RigTypes[player] then 206 | LoadCharacter(player,true) 207 | end 208 | end) 209 | end 210 | 211 | 212 | 213 | 214 | 215 | local function FirstCharacterLoad(player) 216 | print("FirstCharacterLoad function is running") 217 | 218 | if RigTypes[player] ~= Enum.HumanoidRigType.R15 and "R15" or "R6" then 219 | 220 | local Character = player.Character or player.CharacterAdded:Wait() 221 | local Humanoid = Character:WaitForChild("Humanoid") 222 | local RigType = Humanoid.RigType == Enum.HumanoidRigType.R15 and "R15" or "R6" 223 | 224 | RigTypes[player] = RigType 225 | warn("Hey, RigType has been added") 226 | 227 | if RigType == "R6" then 228 | FirstSpawn[player] = true 229 | end 230 | 231 | Character.Parent = nil 232 | LoadCharacter(player) 233 | 234 | elseif RigTypes[player] == Enum.HumanoidRigType.R15 and "R15" or "R6" then 235 | print("Heyo, it's already there!") 236 | print(RigTypes[player]) 237 | end 238 | end 239 | 240 | 241 | 242 | for i,player in pairs(Players:GetPlayers()) do 243 | player:LoadCharacter() 244 | FirstCharacterLoad(player) 245 | end 246 | 247 | 248 | 249 | Players.PlayerAdded:Connect(function(player) 250 | player:LoadCharacter() 251 | FirstCharacterLoad(player) 252 | end) 253 | 254 | Players.PlayerRemoving:Connect(function(player) 255 | RespawnConnections[player] = nil 256 | CharacterPositions[player] = nil 257 | RigTypes[player] = nil 258 | end) 259 | 260 | --[[ 261 | This is Episode 13 of the tutorial series that teaches you ROBLOX Studio fundamentals! 262 | 263 | The full list of instructional scripts from this series can be 264 | found through the ROBLOX group that posted this model. 265 | ]]-- 266 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/11-20/Episode 13 - Team Custom Characters/Source Code (One Character per Team).lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Episode 13 - Team Custom Characters System 4 | Tutorial Link: ( https://youtu.be/dkXCWZdZR-s ) 5 | 6 | This is the non-annotated version of the script. 7 | For comments that explain every line, please refer to the "Team Custom Characters System.rbxm" file in the folder that contains this Source Code 8 | 9 | ]]-- 10 | 11 | ------ Server Script ------ 12 | 13 | local Players = game:GetService("Players") 14 | local Teams = game:GetService("Teams") 15 | 16 | local ServerStorage = game:GetService("ServerStorage") 17 | local TeamCharacters = ServerStorage:WaitForChild("TeamCharacters") 18 | 19 | local RespawnDelay = 2.5 20 | 21 | local RespawnConnections = {} 22 | local CharacterPositions = {} 23 | local RigTypes = {} 24 | 25 | Players.CharacterAutoLoads = false 26 | 27 | local FirstSpawn = {} 28 | 29 | 30 | local function AnimatorCreator() 31 | 32 | for i,Character in pairs(TeamCharacters:GetChildren()) do 33 | 34 | local Humanoid = Character:FindFirstChildOfClass("Humanoid") 35 | 36 | if not Humanoid then 37 | 38 | local NewHumanoid = Instance.new("Humanoid") 39 | NewHumanoid.Name = "Humanoid" 40 | NewHumanoid.RigType = Enum.HumanoidRigType.R15 41 | NewHumanoid.Parent = Character 42 | warn("A Humanoid object has been created for "..Character.Name..". An R15 Humanoid was added by default. \nIf you are using an R6 Character, please manually add one into the Custom Character while editing, then select it, go into its Properties, and change 'RigType' to R6") 43 | 44 | Humanoid = Character:FindFirstChildOfClass("Humanoid") 45 | end 46 | 47 | if Humanoid and not Humanoid:FindFirstChild("Animator") then 48 | warn("No Animator object in Humanoid for "..Character.Name.." -- creating one so Animations replicate to server") 49 | 50 | local AnimateLocalScript = Character:FindFirstChild("Animate") 51 | 52 | if not AnimateLocalScript then warn("No Animate LocalScript detected for "..Character.Name.." please add one for this Character so that it will have proper Animations") 53 | 54 | elseif AnimateLocalScript then 55 | 56 | local Animator = Instance.new("Animator") 57 | Animator.Parent = Humanoid 58 | end 59 | end 60 | end 61 | end 62 | 63 | AnimatorCreator() 64 | TeamCharacters.ChildAdded:Connect(AnimatorCreator) 65 | 66 | 67 | 68 | 69 | 70 | local function RespawnPlayer(player,LoadCharacter) 71 | 72 | if RespawnConnections[player] then 73 | RespawnConnections[player]:Disconnect() 74 | RespawnConnections[player] = nil 75 | end 76 | 77 | if LoadCharacter then 78 | wait(RespawnDelay) 79 | LoadCharacter(player) 80 | end 81 | end 82 | 83 | 84 | 85 | 86 | 87 | local function LoadCharacter(player,NewTeam) 88 | 89 | if RigTypes[player] == nil then 90 | print("No RigType available") 91 | 92 | player:LoadCharacter() 93 | 94 | local Character = player.Character or player.CharacterAdded:Wait() 95 | local Humanoid = Character:WaitForChild("Humanoid") 96 | local RigType = Humanoid.RigType == Enum.HumanoidRigType.R15 and "R15" or "R6" 97 | 98 | RigTypes[player] = RigType 99 | LoadCharacter(player) 100 | 101 | elseif RigTypes[player] ~= nil then 102 | 103 | if player.Neutral == true or not player.Team then player:LoadCharacter() warn(player.Name.." does not have a team/has the 'Neutral' property set to true.\nThe player.Neutral property must be set to false and the player needs a team to be spawned in as a custom character") 104 | 105 | elseif player.Team and player.Neutral == false then 106 | 107 | local RigType = RigTypes[player] 108 | 109 | local FindTeamCharacter = TeamCharacters:FindFirstChild(player.Team.Name..RigType) 110 | 111 | if FindTeamCharacter and NewTeam ~= true then 112 | 113 | print("Teamcharacter found for "..player.Name.." on "..player.Team.Name) 114 | 115 | local NewCharacter = FindTeamCharacter:Clone() 116 | 117 | NewCharacter.Name = player.Name 118 | player.Character = NewCharacter 119 | ------------------------------------------------------------------------------------------- 120 | local SpawnpointsFolder = workspace:FindFirstChild(player.Team.Name.."Spawnpoints") 121 | 122 | if not SpawnpointsFolder then warn("No spawnpoints folder found for "..player.Team.Name..", please follow the instructions around line 90 of the script to resolve this") 123 | 124 | elseif SpawnpointsFolder then 125 | 126 | local Spawnpoints = SpawnpointsFolder:GetChildren() 127 | local RandomSpawn = Spawnpoints[math.random(1,#Spawnpoints)] 128 | warn(RandomSpawn) 129 | 130 | if RandomSpawn.Position ~= nil then 131 | player.Character:SetPrimaryPartCFrame(RandomSpawn.CFrame + Vector3.new(0,2,0)) 132 | end 133 | end 134 | ------------------------------------------------------------------------------------------- 135 | NewCharacter.Parent = game.Workspace 136 | 137 | if FirstSpawn[player] == true and RigTypes[player] == "R6" then 138 | FirstSpawn[player] = nil 139 | 140 | wait(1) 141 | 142 | LoadCharacter(player) 143 | end 144 | 145 | 146 | elseif FindTeamCharacter and NewTeam == true then 147 | 148 | print("Teamcharacter found for "..player.Name.." on "..player.Team.Name) 149 | 150 | CharacterPositions[player] = player.Character:FindFirstChild("HumanoidRootPart").CFrame 151 | 152 | local NewCharacter = FindTeamCharacter:Clone() 153 | 154 | NewCharacter.Name = player.Name 155 | player.Character = NewCharacter 156 | player.Character:WaitForChild("HumanoidRootPart").CFrame = CharacterPositions[player] 157 | NewCharacter.Parent = game.Workspace 158 | 159 | if FirstSpawn[player] == true and RigTypes[player] == "R6" then 160 | FirstSpawn[player] = nil 161 | 162 | wait(1) 163 | 164 | LoadCharacter(player) 165 | end 166 | 167 | else player:LoadCharacter() print("No Teamcharacter found for "..player.Name.." on "..player.Team.Name) 168 | 169 | end 170 | end 171 | end 172 | 173 | local Character = player.Character or player.CharacterAdded:Wait() 174 | local Humanoid = Character:FindFirstChild("Humanoid") 175 | RespawnConnections[player] = Humanoid.Died:Connect(function() 176 | RespawnPlayer(player, LoadCharacter) 177 | end) 178 | end 179 | 180 | 181 | 182 | 183 | 184 | for i,Team in pairs(Teams:GetTeams()) do 185 | Team.PlayerAdded:Connect(function(player) 186 | 187 | if not RigTypes[player] then 188 | warn("No RigType found for a player! The FirstCharacterLoad function needs to finish its task") 189 | 190 | elseif RigTypes[player] then 191 | LoadCharacter(player,true) 192 | end 193 | end) 194 | end 195 | 196 | 197 | 198 | 199 | 200 | local function FirstCharacterLoad(player) 201 | print("FirstCharacterLoad function is running") 202 | 203 | if RigTypes[player] ~= Enum.HumanoidRigType.R15 and "R15" or "R6" then 204 | 205 | local Character = player.Character or player.CharacterAdded:Wait() 206 | local Humanoid = Character:WaitForChild("Humanoid") 207 | local RigType = Humanoid.RigType == Enum.HumanoidRigType.R15 and "R15" or "R6" 208 | 209 | RigTypes[player] = RigType 210 | warn("Hey, RigType has been added") 211 | 212 | if RigType == "R6" then 213 | FirstSpawn[player] = true 214 | end 215 | 216 | Character.Parent = nil 217 | LoadCharacter(player) 218 | 219 | elseif RigTypes[player] == Enum.HumanoidRigType.R15 and "R15" or "R6" then 220 | print("Heyo, it's already there!") 221 | print(RigTypes[player]) 222 | end 223 | end 224 | 225 | 226 | 227 | for i,player in pairs(Players:GetPlayers()) do 228 | player:LoadCharacter() 229 | FirstCharacterLoad(player) 230 | end 231 | 232 | 233 | 234 | Players.PlayerAdded:Connect(function(player) 235 | player:LoadCharacter() 236 | FirstCharacterLoad(player) 237 | end) 238 | 239 | Players.PlayerRemoving:Connect(function(player) 240 | RespawnConnections[player] = nil 241 | CharacterPositions[player] = nil 242 | RigTypes[player] = nil 243 | end) 244 | 245 | --[[ 246 | This is Episode 13 of the tutorial series that teaches you ROBLOX Studio fundamentals! 247 | 248 | The full list of instructional scripts from this series can be 249 | found through the ROBLOX group that posted this model. 250 | ]]-- 251 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/11-20/Episode 13 - Team Custom Characters/Team Custom Characters System.rbxm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emancyphur/Roblox-Studio-Tutorials/c44d9c6a09ed5c31c32beacbc0309545b34eb368/Roblox Studio Tutorial Series/1-100/11-20/Episode 13 - Team Custom Characters/Team Custom Characters System.rbxm -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/11-20/Episode 14 - Weapon Holstering (Wearable Tools)/Item Holstering System.rbxm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emancyphur/Roblox-Studio-Tutorials/c44d9c6a09ed5c31c32beacbc0309545b34eb368/Roblox Studio Tutorial Series/1-100/11-20/Episode 14 - Weapon Holstering (Wearable Tools)/Item Holstering System.rbxm -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/11-20/Episode 14 - Weapon Holstering (Wearable Tools)/Source Code.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Episode 14 - Item Holstering/Wearable Tools 4 | Tutorial Link: ( https://youtu.be/7_My5xBzQZ4 ) 5 | 6 | This is the non-annotated version of the script. 7 | For comments that explain every line, please refer to the "Item Holstering System.rbxm" file in the folder that contains this Source Code 8 | 9 | ]]-- 10 | 11 | ------ Server Script ------ 12 | 13 | local Players = game:GetService("Players") 14 | 15 | local ServerStorage = game:GetService("ServerStorage") 16 | local Items = ServerStorage.Items 17 | 18 | local HolsteringSystem = require(script.Parent.HolsteringModule) 19 | 20 | 21 | 22 | local function ItemHolstering(player) 23 | 24 | player.CharacterAdded:Connect(function(Character) 25 | 26 | player.CharacterRemoving:Connect(function(char) 27 | char:Destroy() 28 | end) 29 | 30 | 31 | 32 | 33 | local Backpack = player:WaitForChild("Backpack") 34 | 35 | 36 | 37 | 38 | Character.ChildAdded:Connect(function(NewItem) 39 | 40 | if NewItem:IsA("Tool") then 41 | 42 | local AccessoryCheck = Character:FindFirstChild(NewItem.Name.."Accessory") 43 | 44 | if AccessoryCheck then 45 | HolsteringSystem.Holster(AccessoryCheck,1) 46 | 47 | elseif not AccessoryCheck then 48 | 49 | local ToolList = HolsteringSystem.GetToolList() 50 | 51 | if ToolList then 52 | 53 | local TableCheck = table.find(ToolList,NewItem.Name) 54 | local Accessories = Items:FindFirstChild("Accessories") 55 | 56 | if TableCheck and Accessories then 57 | 58 | local Accessory = Accessories:FindFirstChild(NewItem.Name.."Accessory") 59 | local Humanoid = Character:WaitForChild("Humanoid") 60 | 61 | if Accessory and Humanoid then 62 | 63 | local ClonedAccessory = Accessory:Clone() 64 | HolsteringSystem.Holster(ClonedAccessory,1,true,Humanoid) 65 | end 66 | end 67 | end 68 | end 69 | end 70 | end) 71 | 72 | 73 | 74 | 75 | 76 | local function ItemRemoved(OldItem,OldContainer) 77 | 78 | if OldItem:IsA("Tool") then 79 | 80 | local AccessoryCheck = Character:FindFirstChild(OldItem.Name.."Accessory") 81 | 82 | if AccessoryCheck and OldContainer == Backpack then 83 | if OldItem.Parent ~= Character then 84 | warn(OldItem.Name.." has left the Backpack and it's not in the Character. The accessory is being destroyed") 85 | AccessoryCheck:Destroy() 86 | end 87 | 88 | 89 | elseif AccessoryCheck and OldContainer == Character then 90 | if OldItem.Parent ~= Backpack then 91 | warn(OldItem.Name.." has left the Character and it's not in the Backpack. The accessory is being destroyed") 92 | AccessoryCheck:Destroy() 93 | 94 | elseif OldItem.Parent == Backpack then 95 | HolsteringSystem.Holster(AccessoryCheck,0) 96 | end 97 | end 98 | end 99 | end 100 | 101 | 102 | 103 | Character.ChildRemoved:Connect(function(OldItem) 104 | ItemRemoved(OldItem,Character) 105 | end) 106 | 107 | Backpack.ChildRemoved:Connect(function(OldItem) 108 | ItemRemoved(OldItem,Backpack) 109 | end) 110 | 111 | 112 | 113 | end) 114 | end 115 | 116 | 117 | for _,player in pairs(Players:GetPlayers()) do 118 | coroutine.wrap(ItemHolstering)(player) 119 | end 120 | 121 | 122 | Players.PlayerAdded:Connect(ItemHolstering) 123 | 124 | 125 | 126 | ------ ModuleScript ------ 127 | 128 | local ServerStorage = game:GetService("ServerStorage") 129 | local Items = ServerStorage.Items 130 | 131 | 132 | 133 | local ToolList = {} 134 | 135 | local function UpdateItemList(NewItem) 136 | 137 | local ToolsFolder = Items:FindFirstChild("Tools") 138 | 139 | if ToolsFolder then 140 | 141 | if NewItem and not table.find(ToolList,NewItem.Name) then 142 | table.insert(ToolList,NewItem.Name) 143 | 144 | else 145 | 146 | for _,Tool in ipairs(ToolsFolder:GetChildren()) do 147 | 148 | if not table.find(ToolList,Tool.Name) then 149 | table.insert(ToolList,Tool.Name) 150 | end 151 | end 152 | end 153 | end 154 | end 155 | 156 | UpdateItemList() 157 | 158 | Items.Tools.ChildAdded:Connect(function(NewItem) 159 | if NewItem:IsA("Tool") then 160 | UpdateItemList(NewItem) 161 | end 162 | end) 163 | 164 | 165 | 166 | 167 | 168 | 169 | local HolsterSystem = {} 170 | 171 | 172 | function HolsterSystem.GetToolList() 173 | return ToolList 174 | end 175 | 176 | 177 | function HolsterSystem.Holster(Accessory,Transparency,AddToCharacter,Humanoid) 178 | 179 | local AccessoryCheck = typeof(Accessory) == "Instance" and Accessory:IsA("Accessory") 180 | local TransparencyCheck = typeof(Transparency) == "number" and Transparency >= 0 and Transparency <= 1 181 | 182 | if AccessoryCheck and TransparencyCheck then 183 | 184 | for _,Item in ipairs(Accessory:GetDescendants()) do 185 | if Item:IsA("BasePart") then 186 | Item.Transparency = Transparency 187 | end 188 | end 189 | end 190 | 191 | 192 | local AddToCharacterCheck = typeof(AddToCharacter) == "boolean" and AddToCharacter 193 | local HumanoidCheck = typeof(Humanoid) == "Instance" and Humanoid:IsA("Humanoid") 194 | 195 | if 196 | AccessoryCheck 197 | and AddToCharacterCheck 198 | and HumanoidCheck then 199 | 200 | Humanoid:AddAccessory(Accessory) 201 | 202 | end 203 | end 204 | 205 | 206 | return HolsterSystem 207 | 208 | --[[ 209 | This is Episode 14 of the tutorial series that teaches you ROBLOX Studio fundamentals! 210 | 211 | The full list of instructional scripts from this series can be 212 | found through the ROBLOX group that posted this model. 213 | ]]-- 214 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/11-20/Episode 15 - Dynamic Team Loadouts/Dynamic Team Loadouts.rbxm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emancyphur/Roblox-Studio-Tutorials/c44d9c6a09ed5c31c32beacbc0309545b34eb368/Roblox Studio Tutorial Series/1-100/11-20/Episode 15 - Dynamic Team Loadouts/Dynamic Team Loadouts.rbxm -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/11-20/Episode 15 - Dynamic Team Loadouts/Source Code.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Episode 15 - Dynamic Team Loadouts/Team-Only Tools 4 | Tutorial Link: ( https://youtu.be/DpBTmWHkXbo ) 5 | 6 | This is the non-annotated version of the script. 7 | For comments that explain every line, please refer to the "Dynamic Team Loadouts.rbxm" file in the folder that contains this Source Code 8 | 9 | ]]-- 10 | 11 | ------ Server Script ------ 12 | 13 | local Players = game:GetService("Players") 14 | 15 | local TeamLoadouts = require(script.Parent.TeamLoadoutsModule) 16 | 17 | 18 | local function PlayerJoin(player) 19 | 20 | player:GetPropertyChangedSignal("Neutral"):Connect(function() 21 | if player.Neutral then 22 | 23 | local Backpack = player:WaitForChild("Backpack") 24 | local Character = player.Character or player.CharacterAdded:Wait() 25 | 26 | if Backpack then 27 | TeamLoadouts.ClearItems(player,Backpack) 28 | end 29 | 30 | if Character then 31 | TeamLoadouts.ClearItems(player,Character) 32 | end 33 | 34 | end 35 | end) 36 | 37 | 38 | 39 | player.CharacterAdded:Connect(function(Character) 40 | 41 | 42 | TeamLoadouts.GiveItems(player) 43 | 44 | 45 | local Backpack = player:WaitForChild("Backpack") 46 | 47 | 48 | 49 | local function IndividualItemCheck(Item) 50 | 51 | if Item:IsA("Tool") then 52 | 53 | TeamLoadouts.ClearItems(player,nil,Item) 54 | end 55 | end 56 | 57 | 58 | Character.ChildAdded:Connect(IndividualItemCheck) 59 | Backpack.ChildAdded:Connect(IndividualItemCheck) 60 | 61 | 62 | 63 | end) 64 | 65 | end 66 | 67 | 68 | for _,player in ipairs(Players:GetPlayers()) do 69 | coroutine.wrap(PlayerJoin)(player) 70 | end 71 | 72 | 73 | Players.PlayerAdded:Connect(PlayerJoin) 74 | 75 | 76 | 77 | ------ ModuleScript ------ 78 | 79 | local TeamLoadouts = {} 80 | 81 | local ServerStorage = game:GetService("ServerStorage") 82 | local MainFolder = ServerStorage.MainFolder 83 | 84 | local Teams = game:GetService("Teams") 85 | 86 | 87 | local function UpdateTeamLoadouts(ToolName,TeamName) 88 | 89 | if ToolName and TeamName then 90 | 91 | if not TeamLoadouts[ToolName] then 92 | TeamLoadouts[ToolName] = TeamName 93 | end 94 | end 95 | end 96 | 97 | 98 | 99 | local function UpdateTeamList(TeamFolder) 100 | 101 | if TeamFolder:IsA("Folder") and Teams:FindFirstChild(TeamFolder.Name) then 102 | 103 | 104 | TeamFolder.ChildAdded:Connect(function(Item) 105 | if Item:IsA("Tool") then 106 | UpdateTeamLoadouts(Item.Name,TeamFolder.Name) 107 | end 108 | end) 109 | 110 | 111 | 112 | TeamFolder.ChildRemoved:Connect(function(Item) 113 | if Item:IsA("Tool") and TeamLoadouts[Item.Name] then 114 | TeamLoadouts[Item.Name] = nil 115 | end 116 | end) 117 | 118 | 119 | 120 | for _,Item in ipairs(TeamFolder:GetChildren()) do 121 | if Item:IsA("Tool") then 122 | UpdateTeamLoadouts(Item.Name,TeamFolder.Name) 123 | end 124 | end 125 | 126 | 127 | end 128 | end 129 | 130 | 131 | MainFolder.ChildAdded:Connect(UpdateTeamList) 132 | 133 | for _,TeamFolder in ipairs(MainFolder:GetChildren()) do 134 | UpdateTeamList(TeamFolder) 135 | end 136 | 137 | 138 | 139 | 140 | 141 | 142 | local MainFunctions = {} 143 | 144 | 145 | function MainFunctions.ClearItems(player,Container,IndividualItem) 146 | 147 | if player:IsA("Player") then 148 | 149 | 150 | local function ItemCheck(Item) 151 | 152 | local LoadoutCheck = TeamLoadouts[Item.Name] 153 | 154 | if LoadoutCheck then 155 | 156 | if player.Neutral or not player.Team then 157 | Item:Destroy() 158 | 159 | 160 | elseif player.Team and not player.Neutral then 161 | if player.Team.Name ~= LoadoutCheck then 162 | Item:Destroy() 163 | end 164 | end 165 | end 166 | end 167 | 168 | 169 | 170 | if IndividualItem then 171 | 172 | if IndividualItem:IsA("Tool") then 173 | wait() 174 | ItemCheck(IndividualItem) 175 | end 176 | 177 | 178 | 179 | 180 | elseif Container then 181 | 182 | for _,Item in ipairs(Container:GetChildren()) do 183 | 184 | if Item:IsA("Tool") then 185 | ItemCheck(Item) 186 | end 187 | end 188 | end 189 | 190 | 191 | end 192 | end 193 | 194 | 195 | 196 | 197 | function MainFunctions.GiveItems(player) 198 | 199 | if player:IsA("Player") then 200 | 201 | local Backpack = player:WaitForChild("Backpack") 202 | local Character = player.Character or player.CharacterAdded:Wait() 203 | 204 | 205 | MainFunctions.ClearItems(player,Backpack) 206 | MainFunctions.ClearItems(player,Character) 207 | 208 | 209 | if player.Team and not player.Neutral then 210 | 211 | local TeamFolder = MainFolder:FindFirstChild(player.Team.Name) 212 | 213 | if TeamFolder then 214 | 215 | for _,Tool in ipairs(TeamFolder:GetChildren()) do 216 | 217 | local BackpackCheck = Backpack:FindFirstChild(Tool.Name) 218 | local CharacterCheck = Character:FindFirstChild(Tool.Name) 219 | 220 | if not BackpackCheck and not CharacterCheck then 221 | 222 | local ClonedTool = Tool:Clone() 223 | ClonedTool.Parent = Backpack 224 | end 225 | end 226 | end 227 | end 228 | end 229 | end 230 | 231 | 232 | 233 | local function TeamChange(Team) 234 | 235 | Team.PlayerAdded:Connect(MainFunctions.GiveItems) 236 | 237 | end 238 | 239 | 240 | Teams.ChildAdded:Connect(function(Team) 241 | 242 | if Team:IsA("Team") then 243 | TeamChange(Team) 244 | end 245 | 246 | end) 247 | 248 | 249 | for _,Team in ipairs(Teams:GetTeams()) do 250 | TeamChange(Team) 251 | end 252 | 253 | 254 | return MainFunctions 255 | 256 | --[[ 257 | This is Episode 15 of the tutorial series that teaches you ROBLOX Studio fundamentals! 258 | 259 | The full list of instructional scripts from this series can be 260 | found through the ROBLOX group that posted this model. 261 | ]]-- 262 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/11-20/Episode 16 - Freecam/Custom Freecam Access.lua: -------------------------------------------------------------------------------- 1 | local Players = game:GetService("Players") 2 | local ServerStorage = game:GetService("ServerStorage") 3 | 4 | local allowedPlayers = {1, 2, 3, 32150440} 5 | local MarketplaceService = game:GetService("MarketplaceService") 6 | 7 | local function playerJoin(player) 8 | 9 | if 10 | MarketplaceService:UserOwnsGamePassAsync(player.UserId, 1) 11 | or table.find(allowedPlayers, player.UserId) 12 | 13 | then 14 | 15 | local Freecam = ServerStorage:FindFirstChild("Freecam") 16 | 17 | if not Freecam then 18 | warn("Freecam ScreenGui is not in the ServerStorage") 19 | return 20 | end 21 | 22 | 23 | local function giveFreecamAccess() 24 | 25 | local PlayerGui = player:WaitForChild("PlayerGui") 26 | local freecamCheck = PlayerGui:FindFirstChild("Freecam") 27 | 28 | if not freecamCheck then 29 | 30 | local newFreecam = Freecam:Clone() 31 | task.delay(1, function() 32 | newFreecam.Parent = PlayerGui 33 | end) 34 | 35 | end 36 | end 37 | 38 | giveFreecamAccess() 39 | player.CharacterAdded:Connect(giveFreecamAccess) 40 | end 41 | end 42 | 43 | 44 | for _, player in ipairs(Players:GetChildren()) do 45 | task.spawn(playerJoin, player) 46 | end 47 | 48 | Players.PlayerAdded:Connect(playerJoin) 49 | 50 | --[[ 51 | This is Episode 16 of the Roblox Studio Tutorial Series! 52 | 53 | The full list of instructional scripts from this series can be 54 | found through the description of the Roblox group that posted this model. 55 | ]]-- 56 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/11-20/Episode 16 - Freecam/Episode 16 - Freecam Resources.rbxm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emancyphur/Roblox-Studio-Tutorials/c44d9c6a09ed5c31c32beacbc0309545b34eb368/Roblox Studio Tutorial Series/1-100/11-20/Episode 16 - Freecam/Episode 16 - Freecam Resources.rbxm -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/11-20/Episode 16 - Freecam/Permanently Disable Freecam.lua: -------------------------------------------------------------------------------- 1 | local function destroyFreecam() 2 | 3 | local Players = game:GetService("Players") 4 | local player = Players.LocalPlayer 5 | local PlayerGui = player:WaitForChild("PlayerGui") 6 | 7 | local Freecam = PlayerGui:WaitForChild("Freecam", 5) 8 | 9 | if Freecam then 10 | Freecam:Destroy() 11 | warn("Freecam Destroyed!") 12 | end 13 | 14 | script:Destroy() 15 | end 16 | 17 | task.delay(2, destroyFreecam) 18 | 19 | --[[ 20 | This is Episode 16 of the Roblox Studio Tutorial Series! 21 | 22 | The full list of instructional scripts from this series can be 23 | found through the description of the Roblox group that posted this model. 24 | ]]-- 25 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/11-20/Episode 17 - Spawning with Custom Hats/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/11-20/Episode 18 - Team-Only GUIs/Source Code.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Episode 18 - Team-Only GUIs (Different GUIs for each team) 4 | Tutorial Link: ( https://youtu.be/m-Ng1XVPFuw ) 5 | 6 | This is the non-annotated version of the script. 7 | For comments that explain every line, please refer to the "Team-Only GUIs.rbxm" file in the folder that contains this Source Code 8 | 9 | ]]-- 10 | 11 | ------ Server Script ------ 12 | 13 | local Players = game:GetService("Players") 14 | local ServerStorage = game:GetService("ServerStorage") 15 | local Teams = game:GetService("Teams") 16 | 17 | local RunService = game:GetService("RunService") 18 | 19 | local function updateGuis(player) 20 | 21 | RunService.Stepped:Wait() 22 | 23 | local PlayerGui = player:WaitForChild("PlayerGui") 24 | 25 | local function guiCheck(onTeam) 26 | for _, Item in ipairs(PlayerGui:GetChildren()) do 27 | 28 | local attributeCheck = Item:GetAttribute("Team") 29 | if attributeCheck then 30 | 31 | for _, Team in ipairs(Teams:GetTeams()) do 32 | if attributeCheck == Team.Name then 33 | if onTeam == true and player.Team.Name ~= attributeCheck then 34 | Item:Destroy() 35 | 36 | elseif onTeam == false then 37 | Item:Destroy() 38 | end 39 | end 40 | end 41 | end 42 | end 43 | end 44 | 45 | 46 | if not player.Team or player.Neutral == true then 47 | guiCheck(false) 48 | 49 | elseif player.Team and player.Neutral == false then 50 | guiCheck(true) 51 | 52 | local guiFolder = ServerStorage:FindFirstChild(player.Team.Name) 53 | 54 | if guiFolder and guiFolder:IsA("Folder") then 55 | 56 | for _, Gui in ipairs(guiFolder:GetChildren()) do 57 | if not PlayerGui:FindFirstChild(Gui.Name) then 58 | local clonedGui = Gui:Clone() 59 | clonedGui.Parent = PlayerGui 60 | end 61 | end 62 | end 63 | end 64 | end 65 | 66 | 67 | 68 | local function playerJoin(player) 69 | 70 | local function activateGuiCheck() 71 | updateGuis(player) 72 | end 73 | 74 | activateGuiCheck() 75 | 76 | player.CharacterAdded:Connect(activateGuiCheck) 77 | 78 | player:GetPropertyChangedSignal("TeamColor"):Connect(activateGuiCheck) 79 | end 80 | 81 | 82 | 83 | for _, player in ipairs(Players:GetPlayers()) do 84 | coroutine.wrap(playerJoin)(player) 85 | end 86 | 87 | Players.PlayerAdded:Connect(playerJoin) 88 | 89 | --[[ 90 | This is Episode 18 of the Roblox Studio Tutorial Series! 91 | 92 | The full list of instructional scripts from this series can be 93 | found through the ROBLOX group that posted this model. 94 | ]]-- 95 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/11-20/Episode 18 - Team-Only GUIs/Team-Only GUIs.rbxm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emancyphur/Roblox-Studio-Tutorials/c44d9c6a09ed5c31c32beacbc0309545b34eb368/Roblox Studio Tutorial Series/1-100/11-20/Episode 18 - Team-Only GUIs/Team-Only GUIs.rbxm -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/11-20/Episode 19 - Roblox Creator Documentation Hub Resources/Source Code.lua: -------------------------------------------------------------------------------- 1 | Not Applicable 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/11-20/[Last] Episode 20 - Future Is Bright Phase 3.0/Not Applicable: -------------------------------------------------------------------------------- 1 | No scripts were provided for Episode 20 of the Roblox Studio Tutorial Series. 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/21-30/Episode 21 - Team-Only Animations/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/21-30/Episode 22 - How To Fix Your Game/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/21-30/Episode 23 - Loadout (Class) Selection System/Loadout Selection System.rbxm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emancyphur/Roblox-Studio-Tutorials/c44d9c6a09ed5c31c32beacbc0309545b34eb368/Roblox Studio Tutorial Series/1-100/21-30/Episode 23 - Loadout (Class) Selection System/Loadout Selection System.rbxm -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/21-30/Episode 23 - Loadout (Class) Selection System/Source Code (Player-Customizable Loadouts).lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Episode 23 - Loadout/Class Selection System (Preset/Custom for each player) 4 | Tutorial Link: ( https://youtu.be/LjETISdUBp8 ) 5 | 6 | This is the non-annotated version of the script. 7 | For comments that explain every line, please refer to the "Loadout Selection System.rbxm" file in the folder that contains this Source Code 8 | 9 | ]]-- 10 | 11 | ------ Server Script ------ 12 | 13 | local Players = game:GetService("Players") 14 | 15 | local ReplicatedStorage = game:GetService("ReplicatedStorage") 16 | local ChangeLoadout = ReplicatedStorage:WaitForChild("ChangeLoadout") 17 | 18 | local ServerStorage = game:GetService("ServerStorage") 19 | local Loadouts = ServerStorage:WaitForChild("Loadouts") 20 | local ServerLoadouts = Loadouts:GetChildren() 21 | 22 | 23 | local Requirements = { 24 | 25 | ["LaserFingerPointers"] = 0, 26 | ["RageTable"] = 0, 27 | ["HyperlaserGun"] = 0, 28 | ["Pinata"] = 0 29 | 30 | } 31 | 32 | 33 | local function ChangePlayerLoadout(player,Text,Frame) 34 | 35 | local textCheck = type(Text) == "string" 36 | local frameCheck = Frame:IsA("Frame") 37 | 38 | if textCheck and frameCheck then 39 | 40 | local leaderstats = player:FindFirstChild("leaderstats") 41 | local Level = leaderstats:FindFirstChild("Level") 42 | 43 | 44 | local function LeaderstatsCheck(requirement) 45 | if leaderstats and Level then 46 | 47 | if Level.Value and Level.Value >= requirement then 48 | return true 49 | end 50 | 51 | else 52 | return false 53 | end 54 | end 55 | 56 | 57 | for name, requirement in pairs(Requirements) do 58 | 59 | local textCheck = Text == name 60 | local checkRequirements = LeaderstatsCheck(requirement) 61 | 62 | 63 | if textCheck and checkRequirements then 64 | 65 | local playerLoadouts = player:FindFirstChild("Loadouts") 66 | local Primary = playerLoadouts:FindFirstChild("Primary") 67 | local Secondary = playerLoadouts:FindFirstChild("Secondary") 68 | 69 | if playerLoadouts then 70 | if Frame.Name == "Primary" and Primary then 71 | Primary.Value = name 72 | return player.Loadouts.Primary 73 | 74 | elseif Frame.Name == "Secondary" and Secondary then 75 | Secondary.Value = name 76 | return player.Loadouts.Secondary 77 | end 78 | end 79 | 80 | 81 | end 82 | end 83 | end 84 | end 85 | ChangeLoadout.OnServerInvoke = ChangePlayerLoadout 86 | 87 | 88 | local function GiveLoadout(player) 89 | 90 | local playervalues = player:WaitForChild("Loadouts"):GetChildren() 91 | local Backpack = player:WaitForChild("Backpack") 92 | 93 | local Character = player.Character or player.CharacterAdded:Wait() 94 | local Humanoid = Character:WaitForChild("Humanoid") 95 | 96 | for i,LoadoutsFolder in pairs(ServerLoadouts) do 97 | for i,PlayerValue in pairs(playervalues) do 98 | if PlayerValue.Name == LoadoutsFolder.Name then 99 | 100 | local NewLoadout = LoadoutsFolder:GetChildren() 101 | 102 | for i,Item in pairs(NewLoadout) do 103 | 104 | if PlayerValue.Value == Item.Name then 105 | 106 | local Clone = Item:Clone() 107 | 108 | local CharacterCheck = Character:FindFirstChild(Item.Name) 109 | local BackpackCheck = Backpack:FindFirstChild(Item.Name) 110 | 111 | Humanoid:UnequipTools() 112 | 113 | if Item:IsA("Tool") and not CharacterCheck or BackpackCheck then 114 | Clone.Parent = Backpack 115 | end 116 | end 117 | end 118 | end 119 | end 120 | end 121 | end 122 | 123 | 124 | Players.PlayerAdded:Connect(function(player) 125 | 126 | local Leaderstats = Instance.new("Folder") 127 | Leaderstats.Name = "leaderstats" 128 | Leaderstats.Parent = player 129 | 130 | local Level = Instance.new("IntValue") 131 | Level.Name = "Level" 132 | Level.Parent = Leaderstats 133 | Level.Value = "0" 134 | 135 | 136 | 137 | local Loadouts = Instance.new("Folder") 138 | Loadouts.Name = "Loadouts" 139 | Loadouts.Parent = player 140 | 141 | local Value1 = Instance.new("StringValue") 142 | Value1.Name = "Primary" 143 | Value1.Parent = Loadouts 144 | Value1.Value = "No Loadout" 145 | 146 | local Value2 = Instance.new("StringValue") 147 | Value2.Name = "Secondary" 148 | Value2.Parent = Loadouts 149 | Value2.Value = "No Loadout" 150 | 151 | player.CharacterAdded:Connect(function(character) 152 | GiveLoadout(player) 153 | end) 154 | end) 155 | 156 | 157 | 158 | ------ LocalScript ------ 159 | 160 | local ScreenGui = script.Parent 161 | local Menu = ScreenGui.Menu 162 | local MainFrame = ScreenGui:WaitForChild("MainFrame") 163 | local TextLabels = MainFrame.TextLabels:GetChildren() 164 | 165 | local ReplicatedStorage = game:GetService("ReplicatedStorage") 166 | local ChangeLoadout = ReplicatedStorage:WaitForChild("ChangeLoadout") 167 | 168 | 169 | 170 | Menu.Activated:Connect(function() 171 | MainFrame.Visible = not MainFrame.Visible 172 | end) 173 | 174 | local function ChangePlayerLoadout(Text,Frame) 175 | print("Sending "..Text.." from a button inside of "..Frame.Name) 176 | 177 | local NewLoadout = ChangeLoadout:InvokeServer(Text,Frame) 178 | 179 | for i,Label in pairs(TextLabels) do 180 | if Label:IsA("TextLabel") and NewLoadout ~= nil and NewLoadout.Name == Label.Name then 181 | Label.Text = NewLoadout.Value 182 | end 183 | end 184 | end 185 | 186 | for i,Item in pairs(MainFrame:GetDescendants()) do 187 | if Item:IsA("TextButton") then 188 | 189 | local Frame = Item.Parent 190 | local Text = Item.Text 191 | 192 | Item.Activated:Connect(function() 193 | 194 | if Text == "Primary" then 195 | MainFrame.Primary.Visible = true 196 | MainFrame.Secondary.Visible = false 197 | 198 | elseif Text == "Secondary" then 199 | MainFrame.Secondary.Visible = true 200 | MainFrame.Primary.Visible = false 201 | 202 | else ChangePlayerLoadout(Text,Frame) 203 | 204 | end 205 | end) 206 | end 207 | end 208 | 209 | --[[ 210 | This is Episode 23 of the tutorial series that teaches you ROBLOX Studio fundamentals! 211 | 212 | The full list of instructional scripts from this series can be 213 | found through the ROBLOX group that posted this model. 214 | ]]-- 215 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/21-30/Episode 23 - Loadout (Class) Selection System/Source Code (Preset Loadouts).lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Episode 23 - Loadout/Class Selection System (Preset/Custom for each player) 4 | Tutorial Link: ( https://youtu.be/LjETISdUBp8 ) 5 | 6 | This is the non-annotated version of the script. 7 | For comments that explain every line, please refer to the "Loadout Selection System.rbxm" file in the folder that contains this Source Code 8 | 9 | ]]-- 10 | 11 | ------ Server Script ------ 12 | 13 | local Players = game:GetService("Players") 14 | 15 | local ReplicatedStorage = game:GetService("ReplicatedStorage") 16 | local ChangeLoadout = ReplicatedStorage:WaitForChild("ChangeLoadout") 17 | 18 | local ServerStorage = game:GetService("ServerStorage") 19 | local Loadouts = ServerStorage:WaitForChild("Loadouts") 20 | local ServerLoadouts = Loadouts:GetChildren() 21 | 22 | 23 | local Requirements = { 24 | 25 | ["Swordsman"] = 0, 26 | ["Brickbattler"] = 0, 27 | 28 | } 29 | 30 | 31 | local function ChangePlayerLoadout(player,Text,Frame) 32 | 33 | local textCheck = type(Text) == "string" 34 | local frameCheck = Frame:IsA("Frame") 35 | 36 | if textCheck and frameCheck then 37 | 38 | local leaderstats = player:FindFirstChild("leaderstats") 39 | local Level = leaderstats:FindFirstChild("Level") 40 | 41 | 42 | local function LeaderstatsCheck(requirement) 43 | if leaderstats and Level then 44 | 45 | if Level.Value and Level.Value >= requirement then 46 | return true 47 | end 48 | 49 | else 50 | return false 51 | end 52 | end 53 | 54 | for name,requirement in pairs(Requirements) do 55 | 56 | local textCheck = Text == name 57 | local checkRequirements = LeaderstatsCheck(requirement) 58 | 59 | if textCheck and checkRequirements then 60 | 61 | local playerLoadout = player:FindFirstChild("Loadouts") 62 | local loadout = playerLoadout:FindFirstChild("loadout") 63 | 64 | if playerLoadout and loadout then 65 | loadout.Value = name 66 | return loadout 67 | end 68 | end 69 | end 70 | end 71 | end 72 | ChangeLoadout.OnServerInvoke = ChangePlayerLoadout 73 | 74 | 75 | local function GiveLoadout(player) 76 | 77 | local playervalues = player:WaitForChild("Loadouts"):GetChildren() 78 | local Backpack = player:WaitForChild("Backpack") 79 | 80 | local Character = player.Character or player.CharacterAdded:Wait() 81 | local Humanoid = Character:WaitForChild("Humanoid") 82 | 83 | for i,LoadoutsFolder in pairs(ServerLoadouts) do 84 | for i,PlayerValue in pairs(playervalues) do 85 | if PlayerValue.Value == LoadoutsFolder.Name then 86 | 87 | local NewLoadout = LoadoutsFolder:GetChildren() 88 | 89 | for i,Item in pairs(NewLoadout) do 90 | 91 | local Clone = Item:Clone() 92 | 93 | local CharacterCheck = Character:FindFirstChild(Item.Name) 94 | local BackpackCheck = Backpack:FindFirstChild(Item.Name) 95 | 96 | Humanoid:UnequipTools() 97 | 98 | if Item:IsA("Tool") and not CharacterCheck or BackpackCheck then 99 | Clone.Parent = Backpack 100 | end 101 | end 102 | end 103 | end 104 | end 105 | end 106 | 107 | 108 | Players.PlayerAdded:Connect(function(player) 109 | 110 | local Leaderstats = Instance.new("Folder") 111 | Leaderstats.Name = "leaderstats" 112 | Leaderstats.Parent = player 113 | 114 | local Level = Instance.new("IntValue") 115 | Level.Name = "Level" 116 | Level.Parent = Leaderstats 117 | Level.Value = "0" 118 | 119 | 120 | 121 | local Loadouts = Instance.new("Folder") 122 | Loadouts.Name = "Loadouts" 123 | Loadouts.Parent = player 124 | 125 | local Value1 = Instance.new("StringValue") 126 | Value1.Name = "loadout" 127 | Value1.Parent = Loadouts 128 | Value1.Value = "No Loadout" 129 | 130 | player.CharacterAdded:Connect(function(character) 131 | GiveLoadout(player) 132 | end) 133 | end) 134 | 135 | 136 | 137 | ------ LocalScript ------ 138 | 139 | local ScreenGui = script.Parent 140 | local Menu = ScreenGui.Menu 141 | local MainFrame = ScreenGui:WaitForChild("MainFrame") 142 | local TextLabels = MainFrame.TextLabels:GetChildren() 143 | 144 | local ReplicatedStorage = game:GetService("ReplicatedStorage") 145 | local ChangeLoadout = ReplicatedStorage:WaitForChild("ChangeLoadout") 146 | 147 | 148 | 149 | Menu.Activated:Connect(function() 150 | MainFrame.Visible = not MainFrame.Visible 151 | end) 152 | 153 | local function ChangePlayerLoadout(Text,Frame) 154 | print("Sending "..Text.." from a button inside of "..Frame.Name) 155 | 156 | local NewLoadout = ChangeLoadout:InvokeServer(Text,Frame) 157 | 158 | for i,Label in pairs(TextLabels) do 159 | if Label:IsA("TextLabel") and NewLoadout ~= nil and NewLoadout.Name == Label.Name then 160 | Label.Text = NewLoadout.Value 161 | end 162 | end 163 | end 164 | 165 | for i,Item in pairs(MainFrame:GetDescendants()) do 166 | if Item:IsA("TextButton") then 167 | 168 | local Frame = Item.Parent 169 | local Text = Item.Text 170 | 171 | Item.Activated:Connect(function() 172 | ChangePlayerLoadout(Text,Frame) 173 | end) 174 | end 175 | end 176 | 177 | --[[ 178 | This is Episode 23 of the tutorial series that teaches you ROBLOX Studio fundamentals! 179 | 180 | The full list of instructional scripts from this series can be 181 | found through the ROBLOX group that posted this model. 182 | ]]-- 183 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/21-30/Episode 24 - Custom Chat Tags & More/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/21-30/Episode 25 - Click To Equip Item/Click to Equip Hat, Clothing, & Tools.rbxm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emancyphur/Roblox-Studio-Tutorials/c44d9c6a09ed5c31c32beacbc0309545b34eb368/Roblox Studio Tutorial Series/1-100/21-30/Episode 25 - Click To Equip Item/Click to Equip Hat, Clothing, & Tools.rbxm -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/21-30/Episode 25 - Click To Equip Item/Source Code (Equip Clothing).lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Episode 25 - Click to Equip Hat, Clothing, & Tools 4 | Tutorial Link: ( https://youtu.be/eWmmZdBM8MY ) 5 | 6 | This is the non-annotated version of the script. 7 | For comments that explain every line, please refer to the "Click to Equip Hat, Clothing, & Tools.rbxm" file in the folder that contains this Source Code 8 | 9 | ]]-- 10 | 11 | ------ Server Script ------ 12 | 13 | local Clothing = workspace:WaitForChild("Clothing"):GetChildren() 14 | 15 | local function NewClothing(player,FirstClothing,SecondClothing) 16 | 17 | local Character = player.Character or player.CharacterAdded:Wait() 18 | local Shirt = Character:FindFirstChildOfClass("Shirt") 19 | local Pants = Character:FindFirstChildOfClass("Pants") 20 | 21 | if not Shirt then 22 | local NewShirt = Instance.new("Shirt") 23 | NewShirt.Name = "Shirt" 24 | NewShirt.Parent = Character 25 | Shirt = Character:FindFirstChildOfClass("Shirt") 26 | end 27 | 28 | if not Pants then 29 | local NewPants = Instance.new("Pants") 30 | NewPants.Name = "Pants" 31 | NewPants.Parent = Character 32 | Pants = Character:FindFirstChildOfClass("Pants") 33 | end 34 | 35 | 36 | 37 | 38 | if Shirt and Pants then 39 | 40 | if FirstClothing:IsA("Shirt") and SecondClothing and SecondClothing:IsA("Pants") then 41 | Shirt.ShirtTemplate = FirstClothing.ShirtTemplate 42 | Pants.PantsTemplate = SecondClothing.PantsTemplate 43 | 44 | elseif FirstClothing:IsA("Shirt") then 45 | Shirt.ShirtTemplate = FirstClothing.ShirtTemplate 46 | 47 | elseif FirstClothing:IsA("Pants") then 48 | Pants.PantsTemplate = FirstClothing.PantsTemplate 49 | end 50 | end 51 | end 52 | 53 | for i,CharacterTemplate in pairs(Clothing) do 54 | 55 | local ClickDetector = CharacterTemplate:FindFirstChildOfClass("ClickDetector") 56 | local Shirt = CharacterTemplate:FindFirstChildOfClass("Shirt") 57 | local Pants = CharacterTemplate:FindFirstChildOfClass("Pants") 58 | 59 | if ClickDetector then 60 | 61 | if Shirt and Pants then 62 | ClickDetector.MouseClick:Connect(function(player) 63 | NewClothing(player,Shirt,Pants) 64 | end) 65 | 66 | elseif Shirt then 67 | ClickDetector.MouseClick:Connect(function(player) 68 | NewClothing(player,Shirt) 69 | end) 70 | 71 | elseif Pants then 72 | ClickDetector.MouseClick:Connect(function(player) 73 | NewClothing(player,Pants) 74 | end) 75 | end 76 | end 77 | end 78 | 79 | --[[ 80 | This is Episode 25 of the Roblox Studio Tutorial Series! 81 | 82 | The full list of instructional scripts from this series can be 83 | found through the ROBLOX group that posted this model. 84 | ]]-- 85 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/21-30/Episode 25 - Click To Equip Item/Source Code (Hats [Accessories]).lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Episode 25 - Click to Equip Hat, Clothing, & Tools 4 | Tutorial Link: ( https://youtu.be/eWmmZdBM8MY ) 5 | 6 | This is the non-annotated version of the script. 7 | For comments that explain every line, please refer to the "Click to Equip Hat, Clothing, & Tools.rbxm" file in the folder that contains this Source Code 8 | 9 | ]]-- 10 | 11 | ------ Server Script ------ 12 | 13 | local ServerStorage = game:GetService("ServerStorage") 14 | local RealHats = ServerStorage.RealHats:GetChildren() 15 | 16 | local FakeHats = workspace:WaitForChild("FakeHats"):GetChildren() 17 | 18 | local function GiveHat(player,FakeHat) 19 | 20 | local Character = player.Character or player.CharacterAdded:Wait() 21 | local HatCheck = Character:FindFirstChild(FakeHat.Name) 22 | local Humanoid = Character:WaitForChild("Humanoid") 23 | 24 | --Humanoid:RemoveAccessories() -- Optionally removes the Accessories of the player when this function is run. Remove the two "--" at the very beginning of the line if you want this to be activated 25 | 26 | if not HatCheck then 27 | for i,RealHat in pairs(RealHats) do 28 | if FakeHat.Name == RealHat.Name then 29 | local ClonedHat = RealHat:Clone() 30 | Humanoid:AddAccessory(ClonedHat) 31 | end 32 | end 33 | end 34 | end 35 | 36 | for i,FakeHat in pairs(FakeHats) do 37 | 38 | local Handle = FakeHat:FindFirstChild("Handle") 39 | local ClickDetector = Handle:FindFirstChildOfClass("ClickDetector") 40 | 41 | if Handle and ClickDetector then 42 | ClickDetector.MouseClick:Connect(function(player) 43 | GiveHat(player,FakeHat) 44 | end) 45 | end 46 | end 47 | 48 | --[[ 49 | This is Episode 25 of the Roblox Studio Tutorial Series! 50 | 51 | The full list of instructional scripts from this series can be 52 | found through the ROBLOX group that posted this model. 53 | ]]-- 54 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/21-30/Episode 25 - Click To Equip Item/Source Code (Tools).lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Episode 25 - Click to Equip Hat, Clothing, & Tools 4 | Tutorial Link: ( https://youtu.be/eWmmZdBM8MY ) 5 | 6 | This is the non-annotated version of the script. 7 | For comments that explain every line, please refer to the "Click to Equip Hat, Clothing, & Tools.rbxm" file in the folder that contains this Source Code 8 | 9 | ]]-- 10 | 11 | ------ Server Script ------ 12 | 13 | local ServerStorage = game:GetService("ServerStorage") 14 | local RealTools = ServerStorage.RealTools:GetChildren() 15 | 16 | local FakeTools = workspace:WaitForChild("FakeTools"):GetChildren() 17 | 18 | local function GiveTools(player,FakeTool) 19 | 20 | local Backpack = player.Backpack 21 | local Character = player.Character or player.CharacterAdded:Wait() 22 | 23 | local BackpackCheck = Backpack:FindFirstChild(FakeTool.Name) 24 | local CharacterCheck = Character:FindFirstChild(FakeTool.Name) 25 | 26 | if Backpack and not BackpackCheck or CharacterCheck then 27 | for i,RealTool in pairs(RealTools) do 28 | if FakeTool.Name == RealTool.Name then 29 | local ClonedTool = RealTool:Clone() 30 | ClonedTool.Parent = Backpack 31 | end 32 | end 33 | end 34 | end 35 | 36 | for i,FakeTool in pairs(FakeTools) do 37 | 38 | local Handle = FakeTool:FindFirstChild("Handle") 39 | local ClickDetector = Handle:FindFirstChildOfClass("ClickDetector") 40 | 41 | if Handle and ClickDetector then 42 | ClickDetector.MouseClick:Connect(function(player) 43 | GiveTools(player,FakeTool) 44 | end) 45 | end 46 | end 47 | 48 | --[[ 49 | This is Episode 25 of the Roblox Studio Tutorial Series! 50 | 51 | The full list of instructional scripts from this series can be 52 | found through the ROBLOX group that posted this model. 53 | ]]-- 54 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/21-30/Episode 26 - Effect Bricks/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/21-30/Episode 27 - Keyword Voice Chat/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/21-30/Episode 28 - Disabling Health Regeneration/Source Code.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Episode 28 - Disabling Health Regeneration 4 | Tutorial Link: ( https://youtu.be/sv6bBYWgJec ) 5 | 6 | This is the second option for disabling health regeneration in your Roblox game. 7 | For comments that explain every line, please refer to the "Commented Version" below the "Non-Commented Version" on this page 8 | 9 | ]]-- 10 | 11 | ------ Non-Commented Version ------ 12 | 13 | 14 | local Players = game:GetService("Players") 15 | 16 | Players.PlayerAdded:Connect(function(player) 17 | player.CharacterAdded:Connect(function(Character) 18 | 19 | local ScriptCheck = Character:FindFirstChild("Health") 20 | 21 | if ScriptCheck and ScriptCheck:IsA("Script") then 22 | ScriptCheck:Destroy() 23 | end 24 | end) 25 | end) 26 | 27 | 28 | ------ Commented Version ------ 29 | -- Place this script into the "ServerScriptService" 30 | 31 | local Players = game:GetService("Players") -- References the Players service 32 | 33 | Players.PlayerAdded:Connect(function(player) -- Activates a function whenever someone joins the game -- the player that joined can be referenced by "player" 34 | player.CharacterAdded:Connect(function(Character) -- Activates a function whenever a player's Character respawns -- the Character that respawned can be referenced by "Character" 35 | 36 | local ScriptCheck = Character:FindFirstChild("Health") -- Creates a varible that will look through the Character for something called "Health" 37 | 38 | if ScriptCheck and ScriptCheck:IsA("Script") then -- If the script finds something called "Health" inside of the Character and the item is a script, then... 39 | ScriptCheck:Destroy() -- The "Health" script will be destroyed 40 | end -- Ends the "if ScriptCheck and "ScriptCheck:IsA("Script")" then statement 41 | end) -- Ends CharacterAdded function 42 | end) -- Ends PlayerAdded function 43 | 44 | 45 | --[[ 46 | This is Episode 28 of the tutorial series that teaches you ROBLOX Studio fundamentals! 47 | 48 | The full list of instructional scripts from this series can be 49 | found through the ROBLOX group that posted this model. 50 | 51 | (But since you're reading this on the GitHub, you're already here!) 52 | ]]-- 53 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/21-30/Episode 29 - Custom Health Bar/Custom Health Bar Model.rbxm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emancyphur/Roblox-Studio-Tutorials/c44d9c6a09ed5c31c32beacbc0309545b34eb368/Roblox Studio Tutorial Series/1-100/21-30/Episode 29 - Custom Health Bar/Custom Health Bar Model.rbxm -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/21-30/Episode 29 - Custom Health Bar/Source Code.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Episode 29 - Custom Health Bar 4 | Tutorial Link: ( https://youtu.be/RzPi-uHslP8 ) 5 | 6 | This is the non-annotated version of the script. 7 | For comments that explain every line, please refer to the "Custom Health Bar Model.rbxm" file in the folder that contains this Source Code 8 | (That file contains the tutorial model that was uploaded to the Roblox website) 9 | 10 | ]]-- 11 | 12 | local Players = game:GetService("Players") 13 | local player = Players.LocalPlayer 14 | 15 | local MainFrame = script.Parent 16 | local TextLabels = MainFrame.TextLabels 17 | local Frames = MainFrame.Frames 18 | 19 | local HealthText = TextLabels.HealthTextLabel 20 | local HealthBar = Frames.HealthBar 21 | 22 | 23 | local TweenService = game:GetService("TweenService") 24 | local Info = TweenInfo.new( 25 | 26 | 0.2, 27 | Enum.EasingStyle.Linear, 28 | Enum.EasingDirection.In, 29 | 0, 30 | false, 31 | 0 32 | 33 | ) 34 | 35 | local function UpdateHealthBar() 36 | 37 | local Character = player.Character 38 | local Humanoid = Character:WaitForChild("Humanoid") 39 | 40 | HealthText.Text = math.round(Humanoid.Health) 41 | 42 | local percent = Humanoid.Health / Humanoid.MaxHealth * 0.794 43 | local Goal = { 44 | 45 | Size = UDim2.new(percent, 0, HealthBar.Size.Y.Scale, 0) 46 | 47 | } 48 | 49 | local Tween = TweenService:Create(HealthBar,Info,Goal) 50 | Tween:Play() 51 | 52 | local ActualHealth = Humanoid.Health / Humanoid.MaxHealth 53 | 54 | if ActualHealth < 0.2 then 55 | HealthBar.BackgroundColor3 = Color3.fromRGB(0,0,170) 56 | 57 | elseif ActualHealth < 0.5 then 58 | HealthBar.BackgroundColor3 = Color3.fromRGB(0,170,0) 59 | 60 | elseif ActualHealth > 0.5 then 61 | HealthBar.BackgroundColor3 = Color3.fromRGB(170,0,0) 62 | end 63 | end 64 | 65 | 66 | local function CharacterRespawned(Character) 67 | 68 | UpdateHealthBar() 69 | 70 | local Humanoid = Character:WaitForChild("Humanoid") 71 | Humanoid.HealthChanged:Connect(UpdateHealthBar) 72 | end 73 | 74 | player.CharacterAdded:Connect(CharacterRespawned) 75 | 76 | if player.Character then 77 | CharacterRespawned(player.Character) 78 | end 79 | 80 | --[[ 81 | This is Episode 29 of the tutorial series that teaches you ROBLOX Studio fundamentals! 82 | 83 | The full list of instructional scripts from this series can be 84 | found through the ROBLOX group that posted this model. 85 | 86 | (But since you're reading this on the GitHub, you're already here!) 87 | ]]-- 88 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/21-30/[Last] Episode 30 - Friend Join Notification/Friend Join Notification LocalScript.rbxm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emancyphur/Roblox-Studio-Tutorials/c44d9c6a09ed5c31c32beacbc0309545b34eb368/Roblox Studio Tutorial Series/1-100/21-30/[Last] Episode 30 - Friend Join Notification/Friend Join Notification LocalScript.rbxm -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/21-30/[Last] Episode 30 - Friend Join Notification/Source Code.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Episode 30 - Friend Join Notification 4 | Tutorial Link: ( https://youtu.be/wuBjzOcVy2I ) 5 | 6 | This is the non-annotated version of the script. 7 | For comments that explain every line, please refer to the "Friend Join Notification LocalScript.rbxm" file in the folder that contains this Source Code 8 | (That file contains the tutorial model that was uploaded to the Roblox website) 9 | 10 | ]]-- 11 | 12 | local StarterGui = game:GetService("StarterGui") 13 | local Players = game:GetService("Players") 14 | 15 | local player = Players.LocalPlayer 16 | 17 | 18 | local imageType = Enum.ThumbnailType.HeadShot 19 | local imageSize = Enum.ThumbnailSize.Size420x420 20 | 21 | local function createNotification(newPlayer) 22 | 23 | local success, avatarIcon, isReady = pcall(function() 24 | return Players:GetUserThumbnailAsync(newPlayer.UserId, imageType, imageSize) 25 | end) 26 | 27 | local templateTable = { 28 | 29 | Title = "A friend joined!", 30 | Text = (newPlayer.Name.." is here!"), 31 | Icon = "rbxthumb://type=AvatarHeadShot&id=1&w=420&h=420", 32 | Duration = 10 33 | } 34 | 35 | if success and avatarIcon and isReady then 36 | templateTable["Icon"] = avatarIcon 37 | end 38 | 39 | StarterGui:SetCore("SendNotification", templateTable) 40 | end 41 | 42 | 43 | Players.PlayerAdded:Connect(function(newPlayer) 44 | 45 | local retryAttempts = 5 46 | local retryDelay = 1 47 | 48 | local success, friendCheck 49 | 50 | 51 | while not success and retryAttempts > 0 do 52 | 53 | success, friendCheck = pcall(function() 54 | return player:IsFriendsWith(newPlayer.UserId) 55 | end) 56 | 57 | retryAttempts -= 1 58 | wait(retryDelay) 59 | end 60 | 61 | if success and friendCheck then 62 | createNotification(newPlayer) 63 | end 64 | end) 65 | 66 | --[[ 67 | This is Episode 30 of the Roblox Studio Tutorial Series! 68 | 69 | The full list of instructional scripts from this series can be 70 | found through the ROBLOX group that posted this model. 71 | ]]-- 72 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/31-40/Episode 31 - Creating Accessories from models, parts, & meshes/Source Code (Automatic Welding).lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Episode 31 - How to make Hats/Accessories 4 | Tutorial Link: ( https://youtu.be/DmsbnwtaVi0 ) 5 | 6 | This is the non-annotated version of the script. 7 | For comments that explain every line, please refer to the "Welding & Accessory Resources.rbxm" file in the folder that contains this Source Code 8 | 9 | ]]-- 10 | 11 | ------ Server Script ------ 12 | 13 | local ServerStorage = game:GetService("ServerStorage") 14 | 15 | local function applyWelds(Accessory) 16 | 17 | local Handle = Accessory.Handle 18 | Handle.Anchored = false 19 | 20 | for _, descendant in ipairs(Accessory:GetDescendants()) do 21 | 22 | 23 | if 24 | descendant:IsA("Weld") 25 | or descendant:IsA("ManualWeld") 26 | or descendant:IsA("WeldConstraint") 27 | then 28 | descendant:Destroy() 29 | end 30 | 31 | 32 | local descendantCheck = descendant:IsA("BasePart") and descendant.Name ~= "Handle" 33 | 34 | if descendantCheck then 35 | descendant.Anchored = false 36 | 37 | local WeldConstrant = Instance.new("WeldConstraint") 38 | WeldConstrant.Parent = Handle 39 | WeldConstrant.Part0 = Handle 40 | WeldConstrant.Part1 = descendant 41 | end 42 | end 43 | 44 | warn("Welding complete for "..Accessory.Name.."!") 45 | end 46 | 47 | 48 | local function setup() 49 | 50 | local originalFolder = ServerStorage:FindFirstChild("Original Accessories") 51 | local newFolder = ServerStorage:FindFirstChild("Welded Accessories") 52 | 53 | if not originalFolder then 54 | local originalAccessoriesFolder = Instance.new("Folder") 55 | originalAccessoriesFolder.Name = "Original Accessories" 56 | originalAccessoriesFolder.Parent = ServerStorage 57 | 58 | originalFolder = ServerStorage:FindFirstChild("Original Accessories") 59 | end 60 | 61 | if not newFolder then 62 | local newAccessoriesFolder = Instance.new("Folder") 63 | newAccessoriesFolder.Name = "Welded Accessories" 64 | newAccessoriesFolder.Parent = ServerStorage 65 | 66 | newFolder = ServerStorage:FindFirstChild("Welded Accessories") 67 | end 68 | 69 | 70 | for _, item in ipairs(ServerStorage:GetChildren()) do 71 | local accessoryCheck = item:IsA("Accessory") 72 | local handleCheck = item:FindFirstChild("Handle") 73 | 74 | if accessoryCheck and handleCheck then 75 | 76 | local clonedAccessory = item:Clone() 77 | clonedAccessory.Parent = newFolder 78 | item.Parent = originalFolder 79 | 80 | applyWelds(clonedAccessory) 81 | end 82 | end 83 | 84 | end 85 | 86 | setup() 87 | 88 | --[[ 89 | This is Episode 31 of the Roblox Studio Tutorial Series! 90 | 91 | The full list of instructional scripts from this series can be 92 | found through the ROBLOX group that posted this model. 93 | ]]-- 94 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/31-40/Episode 31 - Creating Accessories from models, parts, & meshes/Source Code (Basic Examples).lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Episode 31 - How to make Hats/Accessories 4 | Tutorial Link: ( https://youtu.be/DmsbnwtaVi0 ) 5 | 6 | This is the non-annotated version of the script. 7 | For comments that explain every line, please refer to the "Welding & Accessory Resources.rbxm" file in the folder that contains this Source Code 8 | 9 | ]]-- 10 | 11 | ------ Touched Event Server Script ------ 12 | 13 | local Players = game:GetService("Players") 14 | 15 | local Handle = script.Parent 16 | local Accessory = Handle.Parent 17 | 18 | Handle.Touched:Connect(function(object) 19 | local player = Players:GetPlayerFromCharacter(object.Parent) 20 | 21 | if player then 22 | 23 | local Character = player.Character or player.CharacterAdded:Wait() 24 | local Humanoid = Character:FindFirstChildOfClass("Humanoid") 25 | 26 | if Character and Humanoid then 27 | 28 | Humanoid:AddAccessory(Accessory) 29 | 30 | script:Destroy() 31 | end 32 | end 33 | end) 34 | 35 | 36 | ------ ClickDetector Server Script ------ 37 | 38 | local ClickDetector = script.Parent 39 | local Handle = ClickDetector.Parent 40 | local Accessory = Handle.Parent 41 | 42 | ClickDetector.MouseClick:Connect(function(player) 43 | 44 | local Character = player.Character or player.CharacterAdded:Wait() 45 | local Humanoid = Character:FindFirstChildOfClass("Humanoid") 46 | 47 | if Character and Humanoid then 48 | 49 | Humanoid:AddAccessory(Accessory) 50 | 51 | ClickDetector:Destroy() 52 | end 53 | end) 54 | 55 | 56 | ------ ProximityPrompt Server Script ------ 57 | 58 | local ProximityPrompt = script.Parent 59 | local Handle = ProximityPrompt.Parent 60 | local Accessory = Handle.Parent 61 | 62 | ProximityPrompt.TriggerEnded:Connect(function(player) 63 | 64 | local Character = player.Character or player.CharacterAdded:Wait() 65 | local Humanoid = Character:FindFirstChildOfClass("Humanoid") 66 | 67 | if Character and Humanoid then 68 | 69 | Humanoid:AddAccessory(Accessory) 70 | 71 | ProximityPrompt:Destroy() 72 | end 73 | end) 74 | 75 | --[[ 76 | This is Episode 31 of the Roblox Studio Tutorial Series! 77 | 78 | The full list of instructional scripts from this series can be 79 | found through the ROBLOX group that posted this model. 80 | ]]-- 81 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/31-40/Episode 31 - Creating Accessories from models, parts, & meshes/Source Code (CollectionService Examples).lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Episode 31 - How to make Hats/Accessories 4 | Tutorial Link: ( https://youtu.be/DmsbnwtaVi0 ) 5 | 6 | This is the non-annotated version of the script. 7 | For comments that explain every line, please refer to the "Welding & Accessory Resources.rbxm" file in the folder that contains this Source Code 8 | 9 | ]]-- 10 | 11 | ------ Updating Tags Server Script ------ 12 | 13 | local ServerStorage = game:GetService("ServerStorage") 14 | local CollectionService = game:GetService("CollectionService") 15 | 16 | local newFolder = ServerStorage:FindFirstChild("Welded Accessories") 17 | 18 | 19 | local function updateTag(addToTag) 20 | 21 | if newFolder then 22 | for _, Item in ipairs(newFolder:GetChildren()) do 23 | 24 | local classNameCheck = Item:IsA("Accessory") 25 | 26 | if classNameCheck then 27 | 28 | local tagCheck = CollectionService:HasTag(Item, "Accessory") 29 | 30 | if addToTag and not tagCheck then 31 | CollectionService:AddTag(Item, "Accessory") 32 | print(Item.Name.." has been granted the 'Accessory' tag") 33 | 34 | elseif tagCheck and not addToTag then 35 | CollectionService:RemoveTag(Item, "Accessory") 36 | print(Item.Name.." no longer has the 'Accessory' tag") 37 | end 38 | end 39 | end 40 | 41 | else 42 | warn("'Welded Accessories' folder does not exist in the ServerStorage") 43 | end 44 | end 45 | 46 | 47 | local function updateAccessories(addToTag) 48 | 49 | local boolCheck = typeof(addToTag) == "boolean" 50 | 51 | if boolCheck then 52 | updateTag(addToTag) 53 | 54 | else 55 | warn("Value sent through is not a bool.\n 'true' or 'false' are the only allowed values for this function") 56 | end 57 | end 58 | 59 | updateAccessories(true) 60 | 61 | 62 | ------ Equipping Accessories Server Script ------ 63 | 64 | local Players = game:GetService("Players") 65 | local CollectionService = game:GetService("CollectionService") 66 | 67 | 68 | local function instanceCheck(Accessory) 69 | 70 | local classNameCheck = Accessory:IsA("Accessory") 71 | 72 | if classNameCheck then 73 | for _, Item in ipairs(Accessory:GetDescendants()) do 74 | 75 | local clickDetector = Item:IsA("ClickDetector") 76 | local proximityPrompt = Item:IsA("ProximityPrompt") 77 | 78 | if clickDetector or proximityPrompt then 79 | return Item 80 | end 81 | end 82 | end 83 | end 84 | 85 | 86 | 87 | 88 | local function addAccessory(player, Accessory) 89 | local Character = player.Character or player.CharacterAdded:Wait() 90 | local Humanoid = Character:FindFirstChildOfClass("Humanoid") 91 | local accessoryCheck = Character:FindFirstChild(Accessory.Name) 92 | 93 | if Character and Humanoid and not accessoryCheck then 94 | 95 | -- Consider cloning the Accessory for certain use cases, instead 96 | 97 | local clone = Accessory:Clone() 98 | 99 | CollectionService:RemoveTag(clone, "Accessory") 100 | 101 | Humanoid:AddAccessory(clone) 102 | 103 | return clone 104 | 105 | elseif accessoryCheck then 106 | print(player.Name.." already has this Accessory!") 107 | end 108 | end 109 | 110 | 111 | local ClickDetectorConnections = {} 112 | local TouchedEventConnections = {} 113 | local ProximityPromptConnections = {} 114 | 115 | 116 | 117 | 118 | local function updateAccessory(Accessory) 119 | 120 | local classNameCheck = Accessory:IsA("Accessory") 121 | local Handle = Accessory:FindFirstChild("Handle") 122 | 123 | if classNameCheck and Handle then 124 | 125 | local instanceCheck = instanceCheck(Accessory) 126 | 127 | if instanceCheck and instanceCheck.ClassName == "ClickDetector" then 128 | 129 | local function clickDetectorEvent(player) 130 | local successCheck = addAccessory(player, Accessory) 131 | 132 | if successCheck then 133 | local clickDetector = successCheck.Handle:FindFirstChildOfClass("ClickDetector") 134 | 135 | if clickDetector then 136 | clickDetector:Destroy() 137 | end 138 | end 139 | end 140 | 141 | ClickDetectorConnections[Accessory.Name] = instanceCheck.MouseClick:Connect(clickDetectorEvent) 142 | 143 | 144 | elseif instanceCheck and instanceCheck.ClassName == "ProximityPrompt" then 145 | 146 | local function proximityPromptEvent(player) 147 | local successCheck = addAccessory(player, Accessory) 148 | 149 | if successCheck then 150 | local ProximityPrompt = successCheck.Handle:FindFirstChildOfClass("ProximityPrompt") 151 | 152 | if ProximityPrompt then 153 | ProximityPrompt:Destroy() 154 | end 155 | end 156 | end 157 | 158 | ProximityPromptConnections[Accessory.Name] = instanceCheck.TriggerEnded:Connect(proximityPromptEvent) 159 | 160 | 161 | else 162 | 163 | local function touchedEvent(object) 164 | 165 | local player = Players:GetPlayerFromCharacter(object.Parent) 166 | 167 | if player then 168 | local successCheck = addAccessory(player, Accessory) 169 | 170 | if successCheck then 171 | local scriptCheck = successCheck.Handle:FindFirstChildOfClass("Script") 172 | 173 | if scriptCheck then 174 | scriptCheck:Destroy() 175 | end 176 | end 177 | 178 | else 179 | 180 | if TouchedEventConnections[Accessory.Name] then 181 | TouchedEventConnections[Accessory.Name]:Disconnect() 182 | end 183 | 184 | TouchedEventConnections[Accessory.Name] = Handle.Touched:Connect(touchedEvent) 185 | end 186 | end 187 | 188 | 189 | TouchedEventConnections[Accessory.Name] = Handle.Touched:Connect(touchedEvent) 190 | end 191 | end 192 | end 193 | 194 | 195 | local function disconnectEvents(Accessory) 196 | 197 | local ClickDetectorConnection = ClickDetectorConnections[Accessory.Name] 198 | local ProximityPromptConnection = ProximityPromptConnections[Accessory.Name] 199 | local TouchedEventConnection = TouchedEventConnections[Accessory.Name] 200 | 201 | 202 | if ClickDetectorConnection then 203 | warn("Disconnected ClickDetectorConnection from "..Accessory.Name) 204 | ClickDetectorConnection:Disconnect() 205 | 206 | elseif ProximityPromptConnection then 207 | warn("Disconnected ProximityPromptConnection from "..Accessory.Name) 208 | ProximityPromptConnection:Disconnect() 209 | 210 | elseif TouchedEventConnection then 211 | warn("Disconnected TouchedEventConnection from "..Accessory.Name) 212 | TouchedEventConnection:Disconnect() 213 | end 214 | end 215 | 216 | 217 | 218 | 219 | for _, Item in ipairs(CollectionService:GetTagged("Accessory")) do 220 | updateAccessory(Item) 221 | end 222 | 223 | 224 | 225 | CollectionService:GetInstanceAddedSignal("Accessory"):Connect(function(newItem) 226 | updateAccessory(newItem) 227 | end) 228 | 229 | CollectionService:GetInstanceRemovedSignal("Accessory"):Connect(function(oldItem) 230 | disconnectEvents(oldItem) 231 | end) 232 | 233 | --[[ 234 | This is Episode 31 of the Roblox Studio Tutorial Series! 235 | 236 | The full list of instructional scripts from this series can be 237 | found through the ROBLOX group that posted this model. 238 | ]]-- 239 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/31-40/Episode 31 - Creating Accessories from models, parts, & meshes/Source Code (Loops Example).lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Episode 31 - How to make Hats/Accessories 4 | Tutorial Link: ( https://youtu.be/DmsbnwtaVi0 ) 5 | 6 | This is the non-annotated version of the script. 7 | For comments that explain every line, please refer to the "Welding & Accessory Resources.rbxm" file in the folder that contains this Source Code 8 | 9 | 10 | This example is from Episode 25 of my Roblox Studio Tutorial series. 11 | The directory for that Episode can be found here: [ https://github.com/Asians-FTW/ROBLOX-Studio-Tutorials/tree/main/Episodes%201-100/Episodes%2021-30/Episode%2025%20-%20Click%20To%20Equip%20Item ] 12 | 13 | ]]-- 14 | 15 | ------ Server Script ------ 16 | 17 | local ServerStorage = game:GetService("ServerStorage") 18 | 19 | local folderCheck = script:FindFirstChild("RealHats") 20 | 21 | if folderCheck then 22 | folderCheck.Parent = ServerStorage 23 | end 24 | 25 | local RealHats = ServerStorage.RealHats 26 | local FakeHats = workspace["Equipping Accessories Examples"]["Loops Example"]["Hats Setup"].FakeHats 27 | 28 | local function GiveHat(player, FakeHat) 29 | 30 | local Character = player.Character or player.CharacterAdded:Wait() 31 | local HatCheck = Character:FindFirstChild(FakeHat.Name) 32 | local Humanoid = Character:WaitForChild("Humanoid") 33 | 34 | if Character and Humanoid and not HatCheck then 35 | for i,RealHat in pairs(RealHats:GetChildren()) do 36 | if FakeHat.Name == RealHat.Name then 37 | local ClonedHat = RealHat:Clone() 38 | Humanoid:AddAccessory(ClonedHat) 39 | end 40 | end 41 | end 42 | end 43 | 44 | 45 | for i, FakeHat in pairs(FakeHats:GetChildren()) do 46 | 47 | local Handle = FakeHat:FindFirstChild("Handle") 48 | local ClickDetector = Handle:FindFirstChildOfClass("ClickDetector") 49 | 50 | if Handle and ClickDetector then 51 | ClickDetector.MouseClick:Connect(function(player) 52 | GiveHat(player, FakeHat) 53 | end) 54 | end 55 | end 56 | 57 | --[[ 58 | This is Episode 31 of the Roblox Studio Tutorial Series! 59 | 60 | The full list of instructional scripts from this series can be 61 | found through the ROBLOX group that posted this model. 62 | ]]-- 63 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/31-40/Episode 31 - Creating Accessories from models, parts, & meshes/Welding & Accessory Resources.rbxm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emancyphur/Roblox-Studio-Tutorials/c44d9c6a09ed5c31c32beacbc0309545b34eb368/Roblox Studio Tutorial Series/1-100/31-40/Episode 31 - Creating Accessories from models, parts, & meshes/Welding & Accessory Resources.rbxm -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/31-40/Episode 32 - How to enable the Surface Tool/Not Applicable: -------------------------------------------------------------------------------- 1 | No scripts were provided for Episode 32 of the Roblox Studio Tutorial Series. 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/31-40/Episode 33/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/31-40/Episode 34/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/31-40/Episode 35/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/31-40/Episode 36/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/31-40/Episode 37/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/31-40/Episode 38/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/31-40/Episode 39/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/31-40/[Last] Episode 40/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/41-50/Episode 41/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/41-50/Episode 42/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/41-50/Episode 43/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/41-50/Episode 44/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/41-50/Episode 45/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/41-50/Episode 46/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/41-50/Episode 47/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/41-50/Episode 48/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/41-50/Episode 49/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/41-50/[Last] Episode 50/Source Code.lua: -------------------------------------------------------------------------------- 1 | Placeholder 2 | -------------------------------------------------------------------------------- /Roblox Studio Tutorial Series/1-100/All of the Source Code is in Lua!.lua: -------------------------------------------------------------------------------- 1 | (More specifically, Luau, which you can find from the following Roblox GitHub page): 2 | 3 | https://roblox.github.io/luau/ 4 | 5 | ------ The "Code" below is just for funsies :) ------ 6 | 7 | local GitHub = Internet:GetWebsite("GitHub") 8 | 9 | local Profile = GitHub["Emancyphur"] 10 | local MyRepository = Profile["Roblox-Studio-Tutorials"] 11 | 12 | local ChosenPlaylist = MyRepository["Roblox Studio Tutorial Series"] 13 | local EpisodeList = ChosenPlaylist["Episodes 1-100"] 14 | local SourceCodeNote = EpisodeList["All of the Source Code is in Lua!.lua"] 15 | 16 | local function hi(Reader) 17 | print("Hi there! Thanks for reading this "..Reader.Name..". I hope you are having a fantastic day :)") 18 | 19 | if Reader.DayQuality ~= "Good" or not Reader.DayQuality >= "Good" then 20 | print("I hope everything gets better soon, no matter what it is. Take every day of life one step at a time -- the rhythm will lead the way.") 21 | end 22 | end 23 | 24 | SourceCodeNote.ReaderAdded:Connect(hi) 25 | SourceCodeNote.ReaderRemoving:Connect(function(Reader) 26 | print("Thanks for stopping by "..Reader.Name.."! I hope that I have been able to help :)") 27 | end) 28 | 29 | --[[ 30 | 31 | This is the GitHub Repository that contains the contents from Emancyphur's Roblox Studio Tutorial Series! 32 | Thanks for reading! 33 | 34 | - Emancyphur 35 | 36 | ]]-- 37 | -------------------------------------------------------------------------------- /Scripting Solutions/1-10/Episode 1 - 'X is not a valid member of Y' error (Practice Problems)/Instructions - Setting up the Practice Problems.lua: -------------------------------------------------------------------------------- 1 | --[[ NOTE: It is highly recommended to import the model file so that any objects that are necessary for the Practice Problems are already created and can simply be moved to the intended place in the game. 2 | These instructions along with the organized Practice Problems and related objects can be found in the: "Scripting Solutions Episode 1 - Practice Problems" rbxm file. 3 | 4 | If you prefer to view the Practice Problems directly on GitHub, I've included each one in the folder where these Instructions are located. 5 | Specific instructions for manually setting up the Practice Problems (without importing the model file) are included at the beginning of each lua file. 6 | 7 | --]] 8 | 9 | 10 | --[[ Instructions: 11 | 12 | Before starting, make sure the "Explorer", "Properties", and "Output" windows are enabled via the "View" tab at the top left of the screen so it becomes easier to solve the Practice Problems. 13 | 14 | 15 | 1. Open the folder named "Practice Problem Scripts". 16 | This contains 5 different Practice Problems that revolve around solving the "X is not a valid member of Y" error message. 17 | Note: It is recommended to complete these Practice Problems in an empty game so that it becomes easier to know what errors are coming from the Practice Problems. 18 | 19 | 2. To set up a Practice Problem, open one of the "Practice Problem #" folders. 20 | 21 | 3. Inside of each Practice Problem folder are more folders (sorry) that tell you where different objects should be placed for the Practice Problem to work. 22 | 23 | 4. As an example, when you open up the "Practice Problem #1" folder, there are two folders inside: 24 | "For ReplicatedStorage" -- Move any items inside of this folder into the ReplicatedStorage Service 25 | "For ServerScriptService" -- Move any items inside of this folder into the ServerScriptService Service 26 | (Do not move the folder itself. Only the items inside of the folder should be moved) 27 | 28 | 5. Then, enable the script for the Practice Problem by left clicking it once, looking at the "Properties" window, and turning on the "Enabled" property so the code will be able to run when you playtest the game. 29 | 30 | 6. Now, the Practice Problem is ready to be solved! 31 | To see the first error of the Practice Problem, playtest the game via the "Play" or "Play Here" buttons through the "Test" tab at the top left of the screen. 32 | 33 | 7. The error(s) should appear in the Output window. When you are ready to edit the script to try to solve the error, click the "Stop" button through the "Test" tab at the top left of the screen so that the changes to the script will save. 34 | 35 | 8. When you are ready to see if you solved the error(s), repeat step #6 (playtesting the game) to see what appears in the Output. 36 | 37 | 9. If the error(s) weren't fixed, repeat steps 7 and 8. 38 | 39 | 10. When you have solved all of the errors in a Practice Problem, the Output should say: 40 | "Success!" 41 | "You've solved Practice Problem #" 42 | 43 | 11. If you are done with a Practice Problem, make sure to disable the script by left clicking it once, looking at the "Properties" window, and turning off the "Enabled" property so its code wont run anymore. 44 | Then, feel free to move any of the objects related to the Practice Problem back into the folder, or just delete it if you don't mind. 45 | 46 | 12. Repeat steps 2 through 11 for each Practice Problem that you want to try to solve. 47 | 48 | 49 | Thank you for trying out the Practice Problems. 50 | I am happy that you want to improve your game development skills! 51 | 52 | If you have any questions, you can post a comment on the page you got this model from in Roblox's Creator Marketplace, 53 | or on the group wall of the Roblox group that posted this model. 54 | 55 | ]]-- 56 | 57 | 58 | --[[ 59 | 60 | This is Episode 1 of Emancyphur's Scripting Solutions Tutorial Series! 61 | 62 | The full list of practice problem models from this series can be 63 | found through the description of the Roblox group that posted this model. 64 | 65 | 66 | 67 | This model / script was originally published to the Roblox Creator Marketplace by the following group: Emancyphur 68 | 69 | IF the model that contains this script was NOT published by either: 70 | 1. The group called "Emancyphur" 71 | 2. The user named "Emancyphur" 72 | 3. Or the user named "StrongBigeMan9" 73 | it may have been modified from its original state; in that case, use AT YOUR OWN RISK! 74 | 75 | ]]-- 76 | -------------------------------------------------------------------------------- /Scripting Solutions/1-10/Episode 1 - 'X is not a valid member of Y' error (Practice Problems)/Practice Problem #1.lua: -------------------------------------------------------------------------------- 1 | -- Practice Problem #1 (Server-sided / Server Script Code) 2 | 3 | --[[ Necessary objects to set up before solving: 4 | 5 | Create a Script (with "RunContext" property set to "Legacy" or "Server"). Place inside of the "ServerScriptService" Service. Copy the code from line 10 and beyond and paste it into the Script. 6 | Create a "RemoteEvent" (don't change the name). Place inside of the "ReplicatedStorage" Service. 7 | 8 | ]]-- 9 | 10 | local ReplicatedStorage = game:GetService("ReplicatedStorage") 11 | local RemoteEvent = ReplicatedStorage.RemotEvent 12 | RemoteEvent.name = "Practice Problem Example" 13 | 14 | 15 | if RemoteEvent.Name == "Practice Problem Example" then 16 | warn("Success!") 17 | print("You've solved "..script.Name) 18 | end 19 | 20 | --[[ 21 | 22 | This is Episode 1 of Emancyphur's Scripting Solutions Tutorial Series! 23 | 24 | The full list of practice problem models from this series can be 25 | found through the description of the Roblox group that posted this model. 26 | 27 | 28 | 29 | This model / script was originally published to the Roblox Creator Marketplace by the following group: Emancyphur 30 | 31 | IF the model that contains this script was NOT published by either: 32 | 1. The group called "Emancyphur" 33 | 2. The user named "Emancyphur" 34 | 3. Or the user named "StrongBigeMan9" 35 | it may have been modified from its original state; in that case, use AT YOUR OWN RISK! 36 | 37 | ]]-- 38 | -------------------------------------------------------------------------------- /Scripting Solutions/1-10/Episode 1 - 'X is not a valid member of Y' error (Practice Problems)/Practice Problem #2.lua: -------------------------------------------------------------------------------- 1 | -- Practice Problem #2 (Server-sided / Server Script Code) 2 | 3 | --[[ Necessary objects to set up before solving: 4 | 5 | Create a Script (with "RunContext" property set to "Legacy" or "Server"). Place inside of the "ServerScriptService" Service. Copy the code from line 12 and beyond and paste it into the Script. 6 | Create a "Folder" (don't change the name). Place inside of the "Workspace" Service. 7 | Create a "Model" (don't change the name). Place inside of the "Folder". 8 | Create a "Part" (it also should be named "Part", not to be confused with MeshParts and etc.). Place inside of the "Model". 9 | 10 | ]]-- 11 | 12 | local Part = workspace.Part 13 | local clonedPart = Part:Clones() 14 | clonedPart.Name = "A brand new part!" 15 | clonedPart.Parent = workspace.Folder 16 | 17 | 18 | if workspace.Folder:FindFirstChild("A brand new part!") then 19 | warn("Success!") 20 | print("You've solved "..script.Name) 21 | end 22 | 23 | --[[ 24 | 25 | This is Episode 1 of Emancyphur's Scripting Solutions Tutorial Series! 26 | 27 | The full list of practice problem models from this series can be 28 | found through the description of the Roblox group that posted this model. 29 | 30 | 31 | 32 | This model / script was originally published to the Roblox Creator Marketplace by the following group: Emancyphur 33 | 34 | IF the model that contains this script was NOT published by either: 35 | 1. The group called "Emancyphur" 36 | 2. The user named "Emancyphur" 37 | 3. Or the user named "StrongBigeMan9" 38 | it may have been modified from its original state; in that case, use AT YOUR OWN RISK! 39 | 40 | ]]-- 41 | -------------------------------------------------------------------------------- /Scripting Solutions/1-10/Episode 1 - 'X is not a valid member of Y' error (Practice Problems)/Practice Problem #3.lua: -------------------------------------------------------------------------------- 1 | -- Practice Problem #3 (Server-sided / Server Script Code) 2 | 3 | --[[ Necessary objects to set up before solving: 4 | 5 | Create a Script (with "RunContext" property set to "Legacy" or "Server"). Place inside of the "ServerScriptService" Service. Copy the code from line 9 and beyond and paste it into the Script. 6 | 7 | ]]-- 8 | 9 | local ReplicatedStorage = game:GetService("ReplicatedStorage") 10 | 11 | local function lookForObject() 12 | --[[ For this example, imagine the code in this function 13 | is in a completely different script from the code 14 | that starts on line #20 and beyond 15 | --]] 16 | 17 | local theExampleFolder = ReplicatedStorage["Example Folder"] 18 | theExampleFolder.Name = "Renamed Example Folder" 19 | 20 | if ReplicatedStorage:FindFirstChild("Renamed Example Folder") then 21 | warn("Success!") 22 | print("You've solved "..script.Name) 23 | end 24 | end 25 | coroutine.wrap(lookForObject)() 26 | 27 | -- Imagine the new script starts here 28 | 29 | task.wait(2) 30 | 31 | local ReplicatedStorage = game:GetService("ReplicatedStorage") 32 | local ServerStorage = game:GetService("ServerStorage") 33 | 34 | local exampleFolder = Instance.new("Folder") 35 | exampleFolder.Name = "Example Folder" 36 | exampleFolder.Parent = ReplicatedStorage 37 | 38 | --[[ 39 | 40 | This is Episode 1 of Emancyphur's Scripting Solutions Tutorial Series! 41 | 42 | The full list of practice problem models from this series can be 43 | found through the description of the Roblox group that posted this model. 44 | 45 | 46 | 47 | This model / script was originally published to the Roblox Creator Marketplace by the following group: Emancyphur 48 | 49 | IF the model that contains this script was NOT published by either: 50 | 1. The group called "Emancyphur" 51 | 2. The user named "Emancyphur" 52 | 3. Or the user named "StrongBigeMan9" 53 | it may have been modified from its original state; in that case, use AT YOUR OWN RISK! 54 | 55 | ]]-- 56 | -------------------------------------------------------------------------------- /Scripting Solutions/1-10/Episode 1 - 'X is not a valid member of Y' error (Practice Problems)/Practice Problem #4.lua: -------------------------------------------------------------------------------- 1 | -- Practice Problem #4 (Client-sided / LocalScript Code) 2 | -- (When playtesting, choose "Play" or "Play Here" and NOT "Run" mode) 3 | -- ("Run" mode is a server-sided playtest, which wouldn't work with this) 4 | 5 | --[[ Necessary objects to set up before solving: 6 | 7 | Create a LocalScript. Place inside of the "StarterPlayerScripts" folder, which can be found inside of the "StarterPlayer" Service. Copy the code from line 12 and beyond and paste it into the LocalScript. 8 | Create a "ScreenGui" (don't change the name). Place inside of the "ServerStorage" Service. 9 | 10 | ]]-- 11 | 12 | local ServerStorage = game:GetService("ServerStorage") 13 | local ScreenGui = ServerStorage.ScreenGui 14 | 15 | ScreenGui.Destroying:Connect(function() 16 | warn("Success!") 17 | print("You've solved "..script.Name) 18 | end) 19 | 20 | ScreenGui:Destroying() 21 | 22 | --[[ 23 | 24 | This is Episode 1 of Emancyphur's Scripting Solutions Tutorial Series! 25 | 26 | The full list of practice problem models from this series can be 27 | found through the description of the Roblox group that posted this model. 28 | 29 | 30 | 31 | This model / script was originally published to the Roblox Creator Marketplace by the following group: Emancyphur 32 | 33 | IF the model that contains this script was NOT published by either: 34 | 1. The group called "Emancyphur" 35 | 2. The user named "Emancyphur" 36 | 3. Or the user named "StrongBigeMan9" 37 | it may have been modified from its original state; in that case, use AT YOUR OWN RISK! 38 | 39 | ]]-- 40 | -------------------------------------------------------------------------------- /Scripting Solutions/1-10/Episode 1 - 'X is not a valid member of Y' error (Practice Problems)/Practice Problem #5.lua: -------------------------------------------------------------------------------- 1 | -- Practice Problem #5 (Server-sided / Server Script Code) 2 | 3 | --[[ Necessary objects to set up before solving: 4 | 5 | Create a Script (with "RunContext" property set to "Legacy" or "Server"). Place inside of the "ServerScriptService" Service. Copy the code from line 12 and beyond and paste it into the Script. 6 | Create a "Model" (don't change the name). Place inside of the "Workspace" Service. 7 | Create an "Atmosphere" object (don't change the name). Place inside of the "ReplicatedStorage" Service. 8 | Create a "Part" and rename it to "Example". Place inside of the "ServerStorage" Service. 9 | 10 | ]]-- 11 | 12 | local ReplicatedStorage = game:GetService("ReplicatedStorage") 13 | local ServerStorage = game:GetService("ServerStorage") 14 | 15 | coroutine.wrap(function() 16 | print("Waiting 7 seconds until moving the Part called 'Example' to the Workspace...") 17 | task.wait(7) 18 | ServerStorage.example.Parent = workspace.Model["New Folder"] 19 | warn("The Part has been moved to the Workspace!") 20 | end)() 21 | 22 | local function testFunction() 23 | if ReplicatedStorage.atmosphere then 24 | local newObject = Instance.new("Folder") 25 | newObject.Name = "new Folder" 26 | newObject.Parent = ReplicatedStorage -- Hmmm, is this the correct spot to place the object? 27 | 28 | local exampleObject = workspace.Exammple 29 | exampleObject.Names = "Updated Example" 30 | end 31 | end 32 | testFunction() 33 | 34 | 35 | local solutionCheck1 = workspace.Model:FindFirstChild("New Folder") 36 | local solutionCheck2 = solutionCheck1:FindFirstChild("Updated Example") 37 | if solutionCheck1 and solutionCheck2 then 38 | warn("Success!") 39 | print("You've solved "..script.Name) 40 | end 41 | 42 | --[[ 43 | 44 | This is Episode 1 of Emancyphur's Scripting Solutions Tutorial Series! 45 | 46 | The full list of practice problem models from this series can be 47 | found through the description of the Roblox group that posted this model. 48 | 49 | 50 | 51 | This model / script was originally published to the Roblox Creator Marketplace by the following group: Emancyphur 52 | 53 | IF the model that contains this script was NOT published by either: 54 | 1. The group called "Emancyphur" 55 | 2. The user named "Emancyphur" 56 | 3. Or the user named "StrongBigeMan9" 57 | it may have been modified from its original state; in that case, use AT YOUR OWN RISK! 58 | 59 | ]]-- 60 | -------------------------------------------------------------------------------- /Scripting Solutions/1-10/Episode 1 - 'X is not a valid member of Y' error (Practice Problems)/Scripting Solutions Episode 1 - Practice Problems.rbxm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Emancyphur/Roblox-Studio-Tutorials/c44d9c6a09ed5c31c32beacbc0309545b34eb368/Scripting Solutions/1-10/Episode 1 - 'X is not a valid member of Y' error (Practice Problems)/Scripting Solutions Episode 1 - Practice Problems.rbxm --------------------------------------------------------------------------------