Some of Roblox's Services Part 1

Hello there! Ever wondered what some of the services do? Well then you’ve come to the right topic!


Now, there are a lot of services in Roblox so I’ll make follow ups. I’d say it’ll take 5 months to include all the services.


Now, this is part 1 and may not contain a lot of services since each of this services took a long time to explain. Anyways, lets get into it.


First, what are services(this is my explanation, not 100% reliable but this is what I think they are). A service on Roblox is a beneficial piece of code(put in the game’s core) provided by Roblox themselves.
A meaning of a service according to google is:


image


This is the correct meaning since since Roblox’s services are helping you.


Data Store Service


DATA STORE SERVICE



This service is probably the most known but for any new scripters, this service can save data for you.

For example, if you have a leader-stats script, you can save the data using this service. But, if you request to save the data too many times, it’ll refuse your request and it’ll start neglecting your saves.

Here’s an example of how to use this:

local dss = game:GetService("DataStoreService") -- Gets the service, data store service. --
local mydata = dss:GetDataStore("MyName") -- Creates a data store(a key for storing data), your data store name! --

game.Players.PlayerAdded:Connect(function(player) -- Detects when a player joins and passes on the player object --
	local leaderstats = Instance.new("Folder") -- Creates a folder --
	leaderstats.Name = "leaderstats" -- Names the folder leaderstats(You have to name this leaderstats or it won't work) --
	leaderstats.Parent = player -- Parents the folder to the player --
	
	local cash = Instance.new("IntValue") -- Creates an int-value --
	cash.Name = "Cash" -- You can name this whatever you want.
	cash.Parent = leaderstats -- Parents the int value to the folder, "leaderstats" 
	
	 local data -- Makes a variable for data and sets it to nil --
	local success, errormsg = pcall(function() -- Detects if an error is going to occur so it doesn't break the script --
		data = mydata:GetAsync(player.UserId) -- Gets the data and gets the assinged key -- 
	end)
	if data ~= nil then -- If the variable data is not nil --
		cash.Value = data -- It'll change the value of cash to the data that was saved and thus, loading the cash --
	end
end)

game.Players.PlayerRemoving:Connect(function(player) -- Detects when a player leaves and passes on the player object --
	local success, errormsg = pcall(function() -- Detects if an error is going to occur so it doesn't break the script --
		mydata:SetAsync(player.UserId, player.leaderstats.Cash.Value)  -- Sets the data and gets the key, the player's user id and what data it's going to save, you can add a string key but it's optional --	
		
	end)
	if success then -- If the script doesn't error --
		print("Player Data has been saved!") -- It'll print this --
		
	else -- If it there's an error --
		print("There was an error when attempting to save the data") -- It'll print this --
		end
end)

Disclaimer: If you don’t have enable studio to api services on, this will not work.

That’s a simple way of saving data but how about the extras? Well lets look into them.


GetGlobalDataStore()


This will return the default data store.


GetOrderedDataStore()


This function will order a data store that has already been made, for instance, if I made the data store named, “Hi guys” I’d order it through this function.


GetDataStore()


This function will create a global data store, you can use this to create a datastore. A data store is the key to saving data, saved data goes over there and loading data can also be possible with this.


GetRequestBudgetForRequestType()


Will return the number of requests that can be done with a single request type. For instance, lets say you want to know how much requests [Request Type] can do. Lets say it’s 150, well after 150 requests I assume data requests will be neglected and refused.


ListDataStoreAsync()


This function will return a DataListingPages object for enumerating through all the recent datastores in the game.

All of these are information from the Api, if you want to know more, please visit this link.


Services Visible In The Explorer


Services in the explorer!



Now, you’re all familiar with these services:
:
image

But have you ever wondered, what do they do?

First one on the list is workspace:


Workspace


This service can store physical objects such as a part. This service is the service used to display parts.


Secondly, Players!


Players


Players is the service to store the player. It has all the players in there and can even be used to get the useful player functions such as PlayerAdded() or PlayerRemoving(). You can call this one the PlayerManagerService.


Thirdly Lighting!


Lighting


Lighting is the service that manages all the Lighting. It manages the sky, lighting type and etc. You can play around with the properties and make fabulous lighting.


Fourthly, ReplicatedFirst!


ReplicatedFirst


This service is usually useful for the games start, local scripts are the only types of scripts that will run in this service. This can be useful for loading screens since it loads when the game starts.


Fifthly, ReplicatedStorage!


RelicatedStorage


This service can be used to store objects that’ll later be replicated. As listed in the name, this stores items that will be replicated upon cloning and parenting. No scripts will function in this service.


Sixthly, ServerScriptService!


ServerScriptService


This service is used to store scripts on the server. Scripts stored on the server cannot be viewed from the clients and thus, making it safer. This service is useful when trying to make a leader-stats for lets say cash or making a server script.


Seventhly, ServerStorage!


ServerStorage


This can store objects on the server. For example, if you have a part and put it in ServerStorage, you can keep the part safe from exploiters because it can only be accessed on the server. Remember, never trust the client.


Eighthly, StarterGui!


StarterGui


StarterGui is used to store Guis. For example, if you created the main menu in Workspace, chances are it’s not going to show but if you create it in StarterGui, it will show. Guis from here will get replicated into the player’s player gui.


Ninthly, StarterPack!


StarterPack


StarterPack is used to store tools when the player joins the game. For example, if you’re making a fighting game and you have a starter sword, you’d place the sword in StarterPack. Everything here gets replicated to the starter gear and the starter pack found in the player.


Tenthly, StarterPlayer!


StarterPlayer


This service is used to store the character’s scripts such as the health script. You can also use this to manipulate the character such as making health not regenerate by making an empty script name Health in StarterCharacterScripts which is a child of StarterPlayer.


Eleventhly, Teams!


Teams


This service is a service used for storing teams. Lets say your making a fighting game and you have 2 teams, red and blue. These teams can be stored in this service, Teams.


Twelfthly, Sound Service!


SoundService


SoundService is a service used for playing sounds. This service can play sounds. For example, if you have a sound called ModuleScript, this will play the ModuleScript sound but a script is needed.


Thirteenthly, Chat!


Chat


This service monitors the chat and has properties such as bubble chat enabled. This one is the holder of the chat and manages it.


Fourteenthly, LocalizationService!


LocalizationService


This service is used for localising your game to all over the globe. It can also be used to translate text.

Finally, TestService!


TestService


I’ll leave the Roblox API to explain this since I have no way of putting this into my own words.

The TestService is a service used by Roblox internally to run analytical tests on their engine.
It makes it possible to write sophisticated tests right inside a game.


Also, don’t ask why I used these sentence starters.


Tween Service


TweenService



This service is very useful for making parts move nicely. This can be used in a numerous amount of cases. With this, you can make a part move towards a part.


Script for making a part move towards a part:


local tweenservice = game:GetService("TweenService") -- Gets the service, tween service. --
local part = script.Parent -- Defines part. --


local info = TweenInfo.new( -- Creates a table with TweenInfo.new(). --
	2, -- How long it takes to complete the tween. --
	Enum.EasingStyle.Linear, -- Gets an Easing Style, I like to use linear since it's smooth. -- 
	Enum.EasingDirection.Out, -- The direction(now since this is a moving part and not a scaling part, I think you can put whatever you want). --
	3, -- The amount of times it repeats the tween. --
	true, -- The boolean value for reversing the animation or not. --
	0 -- The delay of the animation. -- 
)


local goal = { -- Creates a table(basically a list) --
	Position = Vector3.new(-42.043, 0.5, -9.663) -- Stores Position which is a vector value. --
}

local tweenservicecreate = tweenservice:Create(part, info, goal) -- Definses tweenservicecreate which is a created tween. The parameters is the instance, the tween info table and the goal. --
tweenservicecreate:Play() -- Plays the tween. --

Read the comments on the script, it’ll explain it.
If you need to learn more, click this link.


MarketPlaceService


MarketPlaceService



This service can be used for gamepasses. It basically has a network connected to the marketplace which stores all the gamepasses.


Code example:


LocalScript:


local marketplaceservice = game:GetService("MarketplaceService") -- Gets the service, MarketPlaceService. --
 local players = game:GetService("Players") -- Gets the service, Players. -- 

local gamepassid = 1 -- Put your gamepass id in this one. --

local player = players.LocalPlayer -- Gets the local player. --

script.Parent.MouseButton1Click:Connect(function() -- Triggers when the player presses a button, you can trigger the prompt however you want. --
	marketplaceservice:PromptProductPurchase(player, gamepassid) -- Prompts the product purchase and the parameters required are the player and gamepass id. --
	end)

Server Script:


local players = game:GetService("Players") -- Gets the service, Players. --

local marketplaceservice = game:GetService("MarketplaceService") -- Gets the service, MarketPlaceService. --

local gamepassid = 1 -- Put your gamepass id in this one. --

game.Players.PlayerAdded:Connect(function(player) -- Detects if a player has joined and passes on the player. --

local doyouownthegamepass = marketplaceservice:UserOwnsGamePassAsync(player.UserId, gamepassid) -- Uses userownsgamepassasync to check if the user owns the gamepass. --

if doyouownthegamepass then -- If the player owns the gamepass. --

player.leaderstats.Cash.Value +=1 -- You can do whatever you want if the player owns the gamepass. --

end

end)


Functions




These are the functions of MarketPlaceService. Make sure to follow closely on each one I mention......


GetDeveloperProductsAsync


This returns all the developer products linked to the game by creating a ‘Pages’ object.


GetProductInfo()


Returns the product info of the product. The productid is required as a parameter for this though.


PlayerOwnsAsset


Returns whether or not if the player has the asset/product. There needs to be a given player for this.


PromptBundlePurchase


Prompts a purchase of a bundle, for example the old-school animation pack.


PromptGamePassPurchase


Prompts a gamepass purchase with the given gamepass id.


PromptPremiumPurchase


Prompts the player to purchase premium.


PromptProductPurchase


Prompts a user to purchase a product.


PromptPurchase


Prompts a purchase of an item with a given asset id.


PromptThirdPartyPurchase


Prompts a purchase from a third party provider.


UserOwnsGamePassAsync


This will return true if the player owns the game pass in question.


If you want to know more, please click this.


BadgeService


BadgeService



This service can be used to manager badges and even award them. This service is useful and I’ll be showing you how to use it.


Code:


local BadgeService = game:GetService("BadgeService") -- Gets the service, BadgeService. --
local badgeid = 178 -- Defines badge id, put your badge id here. --

game.Players.PlayerAdded:Connect(function(player) -- Checks when a player joins and passes on the player. --
	BadgeService:AwardBadge(player.UserId, badgeid) -- Awards the badge to the player. --
end)

Functions




AwardBadge


Awards the badge to the given player. An id is required.


GetBadgeInfoAsync()


Fetches the information of the given badge.


UserHasBadgeAsync


Returns true if the user has the badge, returns false if the user doesn’t.

Click this link to learn more!


UserInputService

UserInputService


This service will detect and capture any input that has been inputted by the player.


Code:


local UIS = game:GetService("UserInputService") -- Gets the service, UserInputService. --

UIS.InputBegan:Connect(function(input, isTyping) -- Detects if input has been sent from the user, passes on the input and returns a boolean value of true or false if the player is typing. --
if isTyping then return end -- If the player is typing, it'll do nothing to the player. --

if input.KeyCode == Enum.KeyCode.R then -- Detects if the input has a keycode matching R. --
print("Hi") -- Prints Hi. --
end
end)

Functions



AccelerometerEnabled


Checks if the user has an Accelerometer.


Gamepad Enabled


Checks if the user has a gamepad.


GyroscopeEnabled


Checks if the user has a gyroscope.


KeyboardEnabled


Checks if the user has a keyboard.


ModalEnabled


Toggle on or off to enable or disable the mobile controls.


MouseBehaviour


Determines if the mouse is locked in place or if the mouse can freely move.


MouseDeltaSensivitiy


Changes the delta output of the mouse.


MouseEnabled


Detects whether or not if the user has a mouse.


MouseIconEnabled


Toggle on and off to enable or disable the mouse icon.


OnScreenKeyboardPosition


Calculates the position of an onscreenkeyboard available.


OnScreenKeyboardSize


Calculates the size of an onscreen keyboard available.


OnScreenKeyboardVisible


Determines if an OnscreenKeyboard is available.


TouchEnabled


Detects if a user’s device has a touch-screen available.


VREnabled


Detects if a user has a VR.


Please click this link if you want to learn more, thanks!


PathFindingService

PathFindingService



PathFindingService is a service able to compute a path for a character.


Code Example:


local PathFindingService = game:GetService("PathfindingService") -- Gets PathFindingService. --

local humanoid = script.Parent:WaitForChild("Humanoid") -- Waits for the humanoid to load in and defines, 'humanoid'. --
local character = script.Parent -- Defines, 'character'. --
local finishline = workspace:WaitForChild("FinishLine") -- Waits for, 'finishline' and defines, 'finishline'. --

local path = PathFindingService:CreatePath() -- Creates the instance, 'path'. --

local waypoints -- Stores the waypoints. --
local waypointindex -- Stores the waypoint index. --

local function follow(finishline) -- Creates a function and passes on the variable, 'finishline'. --
	path:ComputeAsync(character.HumanoidRootPart.Position, finishline.Position) -- Computes a path from Point A: HumanoidRootPart's position to point B: finishline's position. --

	waypoints = {} -- Creates an empty table. --

	if path.Status == Enum.PathStatus.Success then -- If the path's status was a success. --
		waypoints = path:GetWaypoints() -- 	Adds to the table, 'waypoints' the path's waypoints. --
		waypointindex = 1 -- Sets the waypoint index to 1. --
		humanoid:MoveTo(waypoints[waypointindex].Position) -- Move the humanoid and guides it towards the waypoints. --
	else -- If it was an error(opposite of if statement.) --
		humanoid:MoveTo(character.HumanoidRootPart.Position) -- Moves the character to it's own position and thus, making the character stay in place. --
	end

path:Destroy() -- Destroys the path(Do not add this if you dont have multiple intersections.) --
end

local function waypointhasbeenreached(reached) -- Creates a function which is called, 'waypointhasbeenreached' and passes on, 'reached'. --
	if reached and waypointindex < #waypoints then -- If, 'reached' and if the index of the waypoints is more than the number of waypoints. --
		waypointindex += 1 -- Adds an extra waypoint index. --
		humanoid:MoveTo(waypoints[waypointindex].Position) -- Moves the humanoid to the current waypoint index. --
	end
end

local function PathBlocked(blockedindex) -- Creates a function called, 'PathBlocked' and passes on, 'blockedindex'. --
	if blockedindex > waypointindex then -- Detects if the blocked index is less than the current waypoints. --
		follow(finishline) -- Calls the function, 'follow' and passes, 'finish line'		
	end
end

path.Blocked:Connect(PathBlocked) -- Connects a blocked event to the, 'PathBlocked' function. --

humanoid.MoveToFinished:Connect(waypointhasbeenreached) -- Connects the, 'MoveToFinished' event to the, 'waypointhasbeenreached' function. --
follow(finishline) -- Calls the function, 'follow' and passes, 'finish line'	
path:ComputeAsync(character.HumanoidRootPart.Position, finishline.Position) -- Computes a path from Point A: HumanoidRootPart's position to point B: finishline's position(Do not add this if you dont have multiple intersections.) --

Functions

Count: 2



CreatePath()


Creates a path. This path object contains waypoints which are dots leading to the path.


FindPathAsync()


Finds the path with 2 points provided.


ContextActionService

Context Action Service is a service that helps with binding specific custom actions that run for a period of time. For example, you could bind an action of a character spinning around in a circle, a character kicking a ball and etc. You can also unbind the action that has already been binded.

Local Script:

-- Services. --
    local ContextActionService = game:GetService("ContextActionService") -- Gets The Service, ContextActionService(We'll be mainly focusing on this service). --

local Action = "Insult exp_lol123" -- Defines Action. --

local function ActionHandler(actionname, inputstatus, inputobj) -- Creates a function while passing on, actionname, inputstatus and inputobj. --
	if actionname == Action and inputstatus == Enum.UserInputState.Begin then -- Detects if the action's name is "Insult exp_lol123" and detects in the input status is equal to the userinputstate of begin. --
		print("Exp_lol123, you make the worst tutorials, am I right?") -- Will print, "Exp_lol123, you make the worst tutorials, right?". --
	end
end

script.Parent.Equipped:Connect(function() -- Detects if the script's parent(tool) has been equipped.
	ContextActionService:BindAction(Action, ActionHandler, true, Enum.KeyCode.LeftShift) -- Will bind an action with the following parameters, action, function(ActionHandler), touchbutton enabled and Enum.KeyCode.LeftShift.
	wait(2)
	ContextActionService:UnbindAction(Action) -- Unbinds the action. --
end)

This whole script will print("Exp_lol123, you make the worst tutorials, am I right?") When you equip the tool and press LeftShift. Although, this obviously can easily be done with UserInputService, this is an example after all. You can do many things with this service.


Functions:


BindAction()


This function allows you to bind an action. But, a given action name is required.


BindActionPriority()


Behaves similarly to BindAction(), this function will set a priority such as 1, 2 and 3. This can allow overlapping input types.


BindActivate()


Binds a keycode with the specific UserInputType given to fire a ClickDetector or Tool/Activation.


GetAllBoundActionInfo()


Creates a table that contains information about all actions that have been bound.


GetBoundActionInfo()


Similar to GetAllBoundActionInfo() but this time will need a specific action.


GetButton()


Fetches an ImageButton of a action that had been bound with a touch input button.


GetCurrentLocalToolIcon()


This will return the texture id of the backpack item(sword, gun and etc.) that is currently equipped by the player.


SetDescription()


With the action name given that contains a touch button, this will set the description of the action.


SetImage()


If the actionname key contains an a lready bound action, then the image will be set as the image of the touchbutton.


SetPosition()


Requires a given bound action. With the given bound action, this will set the position of the touch button contained in the ContextButtonFrame.


SetTitle()


If a action name has been given, this will edit the text shown on the touchbutton.


UnbindAction()


Opposite of BindAction().Will stop the action from playing.


UnbindActivate()


Opposite of BindActivate. This will unbind the user input keycode from triggering tool/activation when bound with BindActivate().


UnbindAllActions()


Will unbind all of the actions. No remnants of the actions will presist, even the action names.


Events



LocalToolEquipped()


Fires when the local player equips the tool.


LocalToolUnequipped()


Fires when the local player unequips the tool.


Big thanks to @octav20071 for reccomending the idea!
If you need anymore help please visit this link. Thank you.


View and edit the game here: game(Note, ContextActionService will not show due to the fact my computer broke and the file is saved on the computer. Thanks.).

Feedback would be appreciated because of the amount of researching put into this! This tutorial took a long time to make so I hope it helped you! To learn more click this link. Thank you!

26 Likes

All of the Services are available on the Developer Hub > Class Tree in detail without little to no mistakes at all. Just a quick search on the internet will lead to the correct results, so this just seems a bit unnecessary.

8 Likes

there are people like me who are way too lazy to search it up

1 Like

Very nice but typo here

Its supposed to be LocalizationService

1 Like

That’s their problem then. There’s no point in listing services on the DevForum because it most likely won’t appear at prominent places in the search results than official devhub articles.

1 Like

Great post! Looks like nothing to say wrong.

In devhub if you got doubts where do you think you’ll ask? The devhub? I find this better because if you have got doubts you can just ask here

I’m glad you all enjoyed it! 1 new service being added soon.

New service added! User Input Service!

Update 2: I’ve made this topic mobile compatible and created a game where you can see how I did all of these stuff, I’m thinking of doing HTTP service but we’ll see.

Kind of true, and kind of not. Clients can see the scripts if they are in workspace, but they can’t actually see the code of the script. However, its best to put scripts in scriptservice anyway.

Yeah, that does make sense to be fair. I believe exploiters can manipulate the server? Not sure though.

1 Like

I don’t think they can exactly CHANGE the server in any way by themselves, but if there is an vulnerability in your scripting then they can probably do bad stuff

1 Like

Unless Roblox commits an oof, it is impossible for an exploiter to directly edit the server.

1 Like

UPDATE:

My computer has stopped working and will need to be fixed, sorry if I don’t update this.

So then what is the point of the #help-and-feedback:scripting-support where you literally can ask questions at there?

Waitting thousands of years (it’s just a joke but some do take hours or more to be answered and it’s the same here and I prefer guilded) (guilded roblox deving server)

Still, I don’t think this should be created.
image

1 Like

Well yes you are right about that

You and @jaipack17 are right. I am not really supposed to make a topic like this but, I enjoy helping a few people.