PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

IsServer

If the code that invoked this method is running in a server context (within or originating from a Script), this method returns true. In all other cases, it returns false. If this returns true, the code has access to server-side features like ServerStorage or ServerScriptService.

Returns

Return Type Summary

Code Samples


Run Context

This code prints out details of a script’s running context, like if it is running on the server, client, in studio, etc. It uses RunService to do this.

Try pasting this code into a Script or LocalScript. See how it runs in online mode and on a Roblox server (open the developer console).

local RunService = game:GetService("RunService")

if RunService:IsStudio() then
	print("I am in Roblox Studio")
else
	print("I am in an online Roblox Server")
end

if RunService:IsRunMode() then
	print("Running in Studio")
end

if RunService:IsClient() then
	print("I am a client")
else
	print("I am not a client")
end

if RunService:IsServer() then
	print("I am a server")
else
	print("I am not a server")
end

if RunService:IsRunning() then
	print("The game is running")
else
	print("The game is stopped or paused")
end