Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

No visible parent?

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

✓ Accepted answer

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

4 comments

0

Thanks Man! I'll try this and will rep if it works.

0

Doesn't ServerScriptService not work with filtering enabled?

1

Upvote, even if wrong.

0

What's wrong about my answer?

This discussion is preserved as it was. New answers, comments, and votes are closed.