Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago
Edited 3 years 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 438 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago
Ad

Answer this question