Hi! I want to print something from a local script inside the player’s character when a boolvalue inside the local script is changed. I’m trying to do it by using GetPropertyChangedSignal but the problem is it does not work.
I tried using .Changed, I tried changing the value myself from the server mode, but nothing. Does anyone have any idea why the local script is not working?
Script inside the ProximityPrompt I’m using, which is working:
local prompt = script.Parent
prompt.Triggered:Connect(function(player)
print("Activated")
local grappleAction = player.Character:FindFirstChild("Grapple"):FindFirstChild("shouldGrapple")
grappleAction.Value = true
wait(1)
grappleAction.Value = false
end)
Local Script inside the player character:
local Action = script.shouldGrapple
Action:GetPropertyChangedSignal("Value"):Connect(function(player)
print("Client")
end)
I thought it was the other way around(If you change something from the client such as a part’s color without using remote events then they won’t replicate to the server)?
Either way, I checked the value in client and server mode and it does change according to the script.
Actually you’re right, I mistaken the reason why it didn’t work. Now I look at it I believe it doesn’t work because localscript is a descendant of workspace and not parented by a character model so it doesn’t run the code inside it.
The localscript is inside the player’s character. The game takes it from startercharacterscripts. The script is inside a ProximityPrompt which is inside a part.
That shouldn’t have done anything. I tested :GetPropertyChangedSignal:Connect and there’s also a code snippet in the docs using the same format. At least it works I guess.