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

How can I detect when a boolvalue's value is changed?

Hi! I want to print something whenever a boolvalue's value is changed but I'm having problems. Help?

Script(in workspace):

local prompt = script.Parent

prompt.Triggered:Connect(function(player)
	print("Activated") --this works
	
	local grappleAction = player.Character:FindFirstChild("Grapple"):FindFirstChild("shouldGrapple")
	grappleAction.Value = true --this works
	wait(1)
	grappleAction.Value = false --this works too
end)

Local Script(in startercharacterscripts):

local Action = script.shouldGrapple

Action.Changed:Connect(function(newvalue)
	print(newvalue)
end)

2 answers

prompt:GetPropertyChangedSignal("Value"):Connect(function(player)--will triger every time the value changes
    --your code here
end)

7 comments

0

Still doesn't print anything.

0

how u changing the boolvalue?

0

Exactly like in the script I posted. I double-checked the value in-game and it does change when it should. But for some reason the local script inside the player does not print when the value changes.

0

u cant change values with scripts in the workspace

0

It doesn't print anything even when I change it from the server.

0

because the boolvalue never changes

0

I just said I'm changing it from the server. It does change and it does not print anything like it should.

local BoolValue = --Bool Value--
Boolvalue.Changed:Connect(Function()
--Do stuff
end)

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