Ad
Log in to vote
0

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

Asked by 7 days ago
Edited 6 days ago

This question has been solved by the original poster.

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!

0
It's answered by me. WINDOWS10XPRO 134 — 7d

1 answer

Log in to vote
0
Answered by 7 days ago
Edited 7 days ago
Ad

Answer this question