How do i copy a Part's Properties With a Script

  1. What do you want to achieve? Keep it simple and clear!
    i want to copy a part’s properties when it changes

  2. What is the issue? Include screenshots / videos if possible!
    my code is causing a error:
    image

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

i tried to look on developer hub a little bit but nothing helped me

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

here’s my code:

script.Parent.Changed:Connect(function(what)
	
if script.Parent:FindFirstChildOfClass('Part') then
		part = script.Parent:FindFirstChildOfClass('Part')
		part[what] = script.Parent[what] -- problem here
	end
	
end)

script.Parent.ChildAdded:Connect(function(what)

	if script.Parent:FindFirstChildOfClass('Part') then
		part = script.Parent:FindFirstChildOfClass('Part')
		local clone = what:Clone()
		clone.Parent = part
	end

end)


also this is my first post in devforum

You could try using module scripts.

module = require(game.Workspace.Script)

return module

Another solution you could use to this.

thanks but i alreadly fixed that!