Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Is it good idea to parent script to the game?

Asked by
imKirda 4491 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

I have made custom module for replacing the TweenService, now i want to access it and i got a very cool idea to make it very easily accessible from multiple scripts, i want it because i want to feel like it is the real service and real services you don't get them like this:

local tweenService = replicatedStorage.modules.container.otherstuff.......

But like this:

local tweenService = game:GetService("TweenService")

So my shorter idea was to parent it to the game

script.Parent = game

I could create module which would do that in studio as you can't parent it to the game in explorer but the question is, is it good idea or should i forget about it, no, trash idea?

Thanks, kirda

1
Why would you want that? Serverscriptservice is good enough! rabbi99 714 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

I would not, the game object is basically the whole game in example.

game.Players

We are using that game object to get the Players Service. I would either use Workspace or SeverScriptService (For a sever script)

(After reading your question more)

You can just put the module script into SeverScriptStorage.

To access the module script,

local SeverScriptService = game:GetService("SeverScriptService") 
local ModuleScript = require(SeverScriptService.TweenModule) 

Sources https://developer.roblox.com/en-us/articles/modulescripts https://developer.roblox.com/en-us/api-reference/function/ServiceProvider/GetService

Skippy

0
Please upvote and accept this as the answer, this helps other users find it more quickly. Skippy_Development 59 — 4y
0
*If it answers the question ^ * Skippy_Development 59 — 4y
Ad

Answer this question