if BoolValue.Value == true then
game.Lighting.TimeOfDay = 12
music.SoundId = Music
music:Play()
gui.Visible = true
GuiClone.TextLabel.Visible = true
end
print("work!")
if BoolValue.Value == false then
game.Lighting.TimeOfDay = 6.5
music.SoundId = ambience.SoundId
music:Play()
gui.Visible = false
GuiClone.TextLabel.Visible = false
end
music:Play()
end
local function onChanged2(plr)
local CC = Character.HumanoidRootPart.Position
GuiClone.TextLabel.Text = math.round(CC.X)..", ".. math.round(CC.Y)..", ".. math.round(CC.Z)
end
onChanged()
onChanged2()
BoolValue.Changed:Connect(onChanged)
Character.HumanoidRootPart:GetPropertyChangedSignal("Position"):Connect(onChanged2)```
#property change help
1 messages · Page 1 of 1 (latest)
I'm not the best scripter, so I'll try my best. What do you want to achieve with this?
I get the changing time of day and playing music, but what do you need humanoid position for?
what's the goal here + what's outputting + what's not working
i just want the change in the position property to fire for the second local function but it seems i did something wrong
no real error in output
any output at all?
I've never had a good time with instance.Changed
Changed is the value right? Or the children
well the other prints and other parts of the script work as normal but just that bit
instance.Changed is when one of the properties change i think
Yeah that's your problem
Your using changed on the boolvalue
Or wait
Can you even use it on the value
Nevermind ignore that
Are you changing the value?
its probably the BoolValue instance
Or is the error the himanoidrootpatt itself?
try this: put print("this") at the start of the first function and print("that") at the start of the second function
this can help you pinpoint the issue
Why are you using getpropertychange signa
?
Right now you are checking if the value is changed, if that is true you then check if the humanoidrootpart.position has changed
also you dont need to do
if bool == true then
code
end
if bool == false then
code
end
you can instead do
if bool == true then
else
end
Why not do humanoidrootpart.cframe or position instead
hes probably using that to check whenever a player moves
I think it's rather a sense of security than insufficient knowledge but yeah good tip
wont fix the issue but its nice
@neon ridge try this
You aren't checking position
That is just a string
That's the problem
Getpropertysignalchanged uses strings and is overall a different solution to instance.changed
Also
In both of your local functions you have parameters
Both of those parameters aren't fulfilled
You execute them without specifying the player
But that doesn't really matter since you don't use it
don't focus on the bool man its not about the bool its about the position value
if the position changed
also the print only fires once
Are you checking if it has changed during the time the bool hasn't changed? Or only if the bool has changed
Because the bool.changed is instant it doesn't wait for the humanoidrootpart
in the script its supposed to fire each time the position changes
the last line
Your not changing the value with that
Sorry i misread it as a function but your not changing the book in the second function
Bool
Autocorrect
don't focus on the bool value that doesn't matter everything there works it fires when the bool changes does what its supposed to its the humanoid root part position change that isn't working right
Alright my bad
Property changed signal uses strings though
Yeah no
Propertychanged doesn't read positions of psychics
Or*
You have to use a different event or function
then how do i check for a changed position
You could use render stepped or heartbeat and set the old position as variable, if the position doesn't match in the loop then it's detected
RunService.Stepped:Connect(function()
if part.Position ~= oldPosition then
print("Position changed!")
oldPosition = part.Position
end
end) ```
This for example
i fixed it
RunService.RenderStepped:Connect(onChanged2)
i just used this
or you could do HumanoidRootPart.Changed to use up less recources
Check your reference to the gui, and you're trying to concatenate numbers with strings
not it, as when i made it runservice everything was as i wanted it was just an issue with finding the change in the hrp position must've set something up wrong
GetPropertyChangedSignal can't detect changes due to physics, hence the player's CFrame.Position changing due to their movement won't fire
https://create.roblox.com/docs/reference/engine/classes/Object#GetPropertyChangedSignal
runservice was a good sub
ah
so i was supposed to do cframe.position instead of just position?
No, it was undoable with getpropertychangedsignal because of its limitations
Cframe.Position is the same as Position
Runservice was the next best thing
oh okay i understand, thank you
but could i do it for gui because there aren't any physics in gui's?
Looks like you can use it to detect a change in a non-physics-based property, so you can use it to detect a property of a gui sure
But you can’t attach an event to a player’s position to fire code when they move because the position changing is physics based
alright alright cause i wanted to do something with a gui next
playing around is my favorite way to learn scripting
local DogPos = Vector2.new(Dog.position.X, Dog.position.Y)
local ShadowPos = Shadow.Position
local SunPos = Vector2.new(Sun.position.X, Sun.position.Y)
local Direction = DogPos - SunPos
local Str = 2
local NeoPos = DogPos + Direction * Str
print(DogPos, ShadowPos, SunPos, Direction, Str, NeoPos)
ShadowPos = UDim2.new(NeoPos.x, 0, NeoPos.y, 0)
end``` im sorry to bother again but could you tell me why this isn't working?
all the positions stay the exact same
if sun and shadow are UI objects, they use UDim2 not Vector2 for size and position
^udim2 documentation
local ShadowPos = Shadow.absolutePosition
local Str = 2
local DogPos = Vector2.new(Dog.Position.X.Offset, Dog.Position.Y.Offset)
local SunPos = Vector2.new(Sun.Position.X.Offset, Sun.Position.Y.Offset)
local Direction = (DogPos - SunPos)
local Direction2 = Vector2.new(Direction.X, Direction.Y)
local NeoPos = DogPos + Direction2 * Str
print(NeoPos, DogPos)
Shadow.Position = UDim2.fromOffset(NeoPos.X, NeoPos.Y)
end``` i can't get it to work
i mean it works but the shadow isn't behind the dog
its completly off
instead of it slightly being behind the dog its like way off
the dog's position isn't the dogs position for some reason trying to make the dogs position the dogs position i got from the same dog makes it different
what are you trying to accomplish
i was trying to do a silly little gui menu where you drag a little sun from left to right to get a value to see how loud or quite jumpscares are but it just all went wrong
guis are so confusing
So it's a volume slider for jumpscares?
where do the dog and shadow come in
is the dog below the sun and you want the dog to be between the shadow and the sun
the sun has a ui drag detector, basically i wanted to make it a bit weird by it being 1 on the sides making the dog have a shadow so left or right but when its right above it would be 0, but i can't even get the visual to work its completly off
i just don't understand it, with script, without script
can you move the UI a bit to show me where the shadow, dog, and sun should be when the slider is at max vs min
just manually
like this, min, max, max
and the shadow would be facing the opposite direction of the shadow
that's pretty tricky, what I would try is:
if the sun is all the way to the left, its x offset is 0, and it's 1 all the way to the right. If it's not, set it up that way.
Put the shadow in a frame such that if it's all the way to the right, its x offset = 1, and if it's all the way to the left, its x offset = 0.
set the shadow's x offset to -(sun's x offset), this way if the sun is all the way to the right of its frame the shadow will be all the way to the left of its frame, and vice versa.
my bad, set the shadow's x offset to (1 - sun's x offset), not -(sun's x offset)
that way if the sun's x offset is 1 the shadow's is 0, and vice versa
thats not the problem right now, something is making the dogs position 0 instead of the position it actually is and ive got no idea why
so at runtime your dog is changing positions?
ctrl + shift + f and search anything referencing dog.Position
it was whatever i was doing that was making it do that cause now i changed it but it doesn't move at all
i think im very close to just giving up man
now this is bothering me too
is this what u were going for
you did before me
how the hell
local DogPos = Dog.AbsolutePosition
local SunPos = Sun.AbsolutePosition
print(DogPos)
local Direction = DogPos - SunPos
local Str = 2
local NeoPos = DogPos + Direction * Str
Shadow.Position = UDim2.fromOffset(NeoPos.X, NeoPos.Y)
end
Sun.Changed:Connect(MegaMathMunch)```
i got the dog itself to sit still but not its shadow
here ya go
thats the ui object, be warned the code is not very neat
free commission 
yours is an rbxm my computer lists roblox files as rbxl's
i can't open it
in your game go to file>import roblox file
rbxl's are full games