Hello, I have a plugin which I want to run in the editor but not in play mode, I tried detecting using runservice:IsRunMode() but the script just keeps running. All help is appreciated thanks.
Put this at the top of your script to prevent it from running during playtesting
local RunService = game:GetService("RunService")
if RunService:IsRunning() then
print("Plugin will not run when playtesting.") -- optional
return
end
You should use RunService:IsRunning()
, not RunService:IsRunMode()
.
RunService:IsRunning()
will return if the game is not in Edit Mode.
2 Likes