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

[Solved] What's the difference between Changed and GetPropertyChangedSignal?

I was learning roblox lua and done some researches, and I found out GetPropertyChangedSignal but in the script they use both getpropertychangedsignal and changed function here's the script of them.

local part = Instance.new("Part")
 
local function onBrickColorChanged()
	print("My color is now " .. part.BrickColor.Name)
end
 
-- Manual detection of a property change
local function onChanged(property)
	if property == "BrickColor" then
		onBrickColorChanged()
	end
end
 
-- Connect both events
part:GetPropertyChangedSignal("BrickColor"):Connect(onBrickColorChanged)
part.Changed:Connect(onChanged)
 
-- Trigger some changes (because we connected twice,
-- both of these will cause two calls to onBrickColorChanged)
part.BrickColor = BrickColor.new("Really red")
part.BrickColor = BrickColor.new("Institutional white")

I'll accept answers that give sense and is right!

1 comment

0

It's answered by me.

1 answer

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