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

No visible parent?

Asked by 8 years ago

I found this function in one of crazyman's scripts.


local mover = (function() local move = script.Movement:Clone() script.Movement:Destroy() return move end)();

the Movement script that this refers to contains code that use CFrame to move a brick when it's touched by a character. Even after I condensed that code to just one line of CFrame movement it still works when I touch it.

Apparently what the function above does is that it creates a clone, and executes that cloned script... Somewhere? Because after :Destroy is called the actual source called Movement is gone, and the entire model seems to run a script from nowhere! It doesn't place it in ServerStorage, or ServerScriptService, nowhere. But IT STILL RUNS?!

BUT, when I replace Movement with my own code which should theoretically still work on it's own:


while true do script.Parent.Flash.Enabled = true wait(1) print("LIGHT FLASHED") script.Parent.Flash.Enabled = false end

and the original function is replaced with:


local flasher = (function() local flash = script.FLASHING:Clone() script.FLASHING:Destroy() return flash end)();

When I make it so that crazyman's script is now the Parent of my script which shouldn't break it, but the flashing doesn't start at all. It's like the cloning script knows which is the original and which is not! Also, the fact it is not a child of anything makes it even more confusing.

I'm hoping to crack is problem because a working script which code can't be observed in explorer/Studio can be very beneficial in deterring some exploiters from being able to steal your code.

1 answer

Log in to vote
2
Answered by
Merely 2122 Moderation Voter Community Moderator
8 years ago

If you want a script that exploiters can't access, just put it in ServerScriptService.

If you don't want the script to be accessible even if you have server script access, just add this as the first line of your script. It should continue to run even when parented to nil. script.Parent = nil

0
Thanks Man! I'll try this and will rep if it works. Encladeus 31 — 8y
0
Doesn't ServerScriptService not work with filtering enabled? AwsomeSpongebob 350 — 8y
1
Upvote, even if wrong. JamesLWalker 297 — 8y
0
What's wrong about my answer? Merely 2122 — 8y
Ad

Answer this question