Script.Source changing

It is possible to detect script source changing.
For example if ill use

Script.Changed:Connect(function(changed)
print(changed)
end)

Will it print “Source” after changing script source?

2 Likes

What do you mean Script Source, I may be mistaken but Script.Changed doesn’t exist. Or wouldn’t do anything if its disabling itself anyways.

Edit:Script.Changed does exist but redundant on its self but might be of use on other scripts

Changed - its a event what fires then some value changed on object.

GetPropertyChangedSignal does this but don’t know will this work, is that what you’re looking for?

script:GetPropertyChangedSignal("Source"):Connect(function()
    print("Script source changed")
end)

What’s the use case for this exactly? There’s not a need for it unless it’s plugin development.

By Script.Souce do you mean script.Parent, like its in a different location?

Script.Source refers to the source code of a local script, script, or module script. It can only be used by plugins though.

1 Like

If you use that function on Scripts, for checking the source change, it will give a permission denied error, as its stated on the documentation its only allowed from command bar and plugins.

Source can only be chanced/gotten by plugins, I think a getpropertychangedsignal would work? Not sure.

How do you know it’s not a command bar/plugin script? The OP didn’t state anything about this, the OP could be scripting for a plugin.

1 Like

Yeah, I am aware of that but, when did I say that you can’t use it, its just that I am saying if its used from game script it will error :slightly_smiling_face:

1 Like

GUYS IT WORKS! No errors. Thank you all for trying help me.

What even is your use case for checking changes to a script’s source? This was never clarified and your solution doesn’t exactly explain what solution you arrived at either - just “it works now”. What is “it”? What did you do to get it to work?

You need to include these kinds of details in your posts.

1 Like

Oh sry. Ok so.
Im making antiexploit. And since Exploiters can edit script source i needed do this.
It works like

localscript.Changed:Connect(function(changed)
print(changed)
end)

Source is a locked property. Exploiters don’t (need to) edit a script’s source and they can’t either (at least in a way that’d be relevant to them), they manipulate other parts of the game such as memory addresses and sending spoofed data to remotes.

It’s good that you were asked for your use case, because you were about to spend a lot of time trying to attach changed events to every single script (or at least a number of them) for no reason. If those changed events really do fire, you’re going to be in huge trouble for performance.

You should be combating exploiting in different mannerisms, be it stopping the actual vector used to exploit or making a counteracting script that checks for the usual patterns of an exploit and acting kicking based off of that.

Exploiters can also just disconnect or void your event, since this is client-sided anti-exploit.

1 Like

Dont worry about perfomace. All under control.
im using 3 sides protection (LocalScript, ServerScript, SpyScript)
and all of them connected without remotes (in most case)

No it’s really not under control lol. The very issue is the fact that you’re using a Changed event and no amount of other methods you’re applying in parallel is going to make a difference: the Changed event itself is the problem. Furthermore, as I later learned, you’re doing it on the client. Exploiters can bypass, disconnect or change your connection on their own terms. You aren’t winning this battle against exploiters especially when you’re trying to fight them on their own machine: what you’re doing is extremely pointless for zero gain and enough risk.

2 Likes

Exploiters. Can’t. Change. Script. Source. Once. It. Is. Run. It’s a locked property as @colbet2677 said. Focus on speed exploits, or flying. Stuff like that.

Ok ok. Thanks for informing me. Have a nice day good luck