GetPropertyChangedSignal won't work

I’ve been trying to get to print the position of the part in this script with a “GetPropertyChangedSignal” and it won’t work for any reason. And I wanted to get help if I could on what I did wrong on this script, you can comment on which line I made I made a mistake on, thanks for the support!

local Character = script.Parent.Parent
local HumanoidRootPart = Character.HumanoidRootPart

local Weld = Instance.new("Weld")
local Part = Instance.new("Part")

Part.Transparency = 1
Part.Position = HumanoidRootPart.Position
Part.Size = HumanoidRootPart.Size
Part.CanCollide = false
Part.Massless = true

Weld.Part0 = Part
Weld.Part1 = HumanoidRootPart

Weld.C0 = HumanoidRootPart.CFrame:Inverse()
Weld.C1 = Part.CFrame:Inverse()

Weld.Parent = Part
Part.Parent = HumanoidRootPart

-- This is the important part
Part:GetPropertyChangedSignal("Position"):Connect(function()
	print(Part.Position)
end) 

3 Likes
script.Parent.Changed:Connect(function(Changed)
	if Changed == "Position" then
		print(Changed)
	end
end)

This won’t fire by the fact it’s Welded. The GetPropertyChangedSignal("Position") Event will only fire whenever a BasePart’s Position changes without it welded or attached to anything. Plus, I tested it and it worked without being attached - While being attached didn’t work.

:GetPropertyChangedSignal doesn’t work for positions. Use RunService.Stepped instead:

--//Services
local RunService = game:GetService("RunService")

--//Variables
local Character = script.Parent.Parent
local HumanoidRootPart = Character.HumanoidRootPart

local Weld = Instance.new("Weld")
local Part = Instance.new("Part")

Part.Transparency = 1
Part.Position = HumanoidRootPart.Position
Part.Size = HumanoidRootPart.Size
Part.CanCollide = false
Part.Massless = true

Weld.Part0 = Part
Weld.Part1 = HumanoidRootPart

Weld.C0 = HumanoidRootPart.CFrame:Inverse()
Weld.C1 = Part.CFrame:Inverse()

Weld.Parent = Part
Part.Parent = HumanoidRootPart

--//Controls
local oldPosition = Part.Position

--//Functions
RunService.Stepped:Connect(function()
	local newPosition = Part.Position
	
	if newPosition ~= oldPosition then
		oldPosition = newPosition
		print("Position has changed", newPosition)
	end
end)

This worked, thank you very much!

1 Like

No problem, have a good day!
If you need any more help, feel free to ask.