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

For some reason, GetPropertyChangeSignal:Connect doesn't work. Why?

Im writing a script for ghost, using Humanoid.HipHeight, so it can "fly" above other creatures, but without changing height (Position Y) of the ghost, based on creatures it flying above . Here it is:


--// Humanoid of Ghost
local Humanoid = script.Parent.Humanoid

--// The part, which is base for counting height
local Floor = workspace.Arena.Floor

--// Humanoid root part as it is
local HRPart = script.Parent.HumanoidRootPart

--// The position Y, ghost.HumanoidRootPart should always be (using Floor.Size.X is because Floor shape is a Cylinder. 10 is because base HipHeight of ghost is 10)
local BaseY = Floor.Position.Y + Floor.Size.X/2 + 10 + HRPart.Y/2

--// Floor Y is 0, SizeX is 2, HRPart is standart: 2,2,1. So 0+1+10+1 = (12), this is exactly printed, so it's right.
print(BaseY)

--// Ghost have a boolean value "OnArena" inside, that changes once it teleported to arena.
script.Parent.OnArena.Changed:Wait()

--// Me checking if "OnArena" accepted and script continue.
print("ON ARENA")


--// THIS is never works.
HRPart:GetPropertyChangedSignal("Position"):Connect(function()
	--// Never prints :)
	print("It does change the position, at least cuz its walking lol")
	if HRPart.Position.Y ~= BaseY then
		Humanoid.HipHeight = Humanoid.HipHeight - (HRPart.Position.Y - BaseY)
	end
end)

No errors in console. So, i have no idea why moving Ghost doesn't trigger change of it's HumanoidRootPart Position.

1 answer

GetPropertyChangedSignal("Position") and some other properties (like CFrame) don't fire at all. Not sure why, but I think it's intended behaviour.

1 comment

0

If i dont check "OnArena" and script starts once ghost appear in workspace, then GetPropertyChangedSignal("Position") fires, but only once, so seems like it can fire at least.

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