How do i make a script not run in roblox studio

i want the script to run ingame but not in roblxo studio

1 Like

Copy all of the code that should run in-game into the if statement here, and it should do what you want.

local RunService = game:GetService("RunService")

if not RunService:IsStudio() then
	-- run the code that only runs in-game

A better method:

if game:GetService("RunSerivce"):IsStudio() then

--Put your code after

funny thing i came up with that on my own after looking at code samples

i was thinking return could only be used in module scripts

No, return just stops a thread.

A script is one big thread; functions and logic statements are threads within a bigger thread.