Issue with roblox script editor updating script

im making a plugin, its suppose to be able to set new scripts that are made to stuff
it works but i have to reload to script to see it

local function set(part:Instance)
	if enabled then
		check()
		if part:IsA("Script") then
			if ScriptDefault then
				part.Source = ScriptDefault
			end
		elseif part:IsA("LocalScript") then
			if LScriptDefault then
				part.Source = LScriptDefault
			end
		elseif part:IsA("ModuleScript") then
			if MScriptDefault then
				part.Source = MScriptDefault
			end
		
		
	end
	end
end

button.Click:Connect(enable)
game.DescendantAdded:Connect(set)

whats wrong with it?

1 Like

I think this is what you’re looking for.

2 Likes

what do you mean you have to “reload the script”?
i copy pasted the code above and it works perfectly fine for me

1 Like

What’s the purpose of button.Click? And what ScriptDefault variables contains?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.