.Changed not working

Hello ive been having trouble with BoolValue.Changed

image

image

LocalScript code:

local clicksneeded = 10
local clickcooldown = 0.25
local clickcool = true
local clickedtimes = 0 
local intime = script.Time.Value
local beingclicked = false
local clicked = false
local player = game.Players.LocalPlayer

player.PlayerGui.ScreenGui.TextButton.LocalScript.Completing.Changed:Connect(function()
	print("Changed")
	
	if script.Completing.Value == true then
		player.PlayerGui.ScreenGui.TextButton.Visible = true
		player.PlayerGui.ScreenGui.Countdown.Visible = true
	end
	
	if script.Completing.Value == false then
		player.PlayerGui.ScreenGui.TextButton.Visible = false
		player.PlayerGui.ScreenGui.Countdown.Visible = false
	end
end)



script.Parent.MouseButton1Click:Connect(function()
	if clickcool == true then
		script.Parent.Parent.Countdown.Visible = true
		clicked = true
		beingclicked = true
		print(beingclicked)
		clickedtimes = clickedtimes + 1
		script.Parent.Text = clickedtimes.. "/".. clicksneeded
		clickcool = false
		wait(clickcooldown)
		clickcool = true

		if clicksneeded == clickedtimes then
			script.Completed = true
			clickcool = false
			script.Parent.Text = "Lockpicked sucsesfully!"
			clicked = false
			script.Completed = true
			wait(1)
			clickcool = true
			script.Parent.Visible = false
			print("done")
			beingclicked = false
		end
	end
end)


ProxPrompt code:


local opened = false
local proximityPrompt = script.Parent
local isEquipped = game.StarterPack.Key.Script.isEquipped.Value
local leftDoor = script.Parent.Parent.Parent.Parent.LeftDoor.LeftDoor1
local rightDoor = script.Parent.Parent.Parent.Parent.RightDoor.RightDoor1
local completing = game.StarterGui.ScreenGui.TextButton.LocalScript.Completing.Value

proximityPrompt.Triggered:Connect(function()
	if opened == true then
		completing = false
		print(completing)
		print("Closed")
		opened = false
	else
		completing = true
		print(completing)
		print("opened")
		opened = true
	end
	
end)

i hope you can help so heres more info,

The BoolValue is getting changed like shown in print(completing)

But it wont print that its been changed.

1 Like

How are you changing the value? Are you doing it through the explorer? If that’s the case, make sure you’re changing the correct one (descendant of the Player, not StarterGui). If you’re changing it in a script, can we see that script?

1 Like

Its nott in a local script cant refer to playerGui

I can see that you are editing the value which is under StarterPack under the ProxPrompt code. Make sure to check the value which has since been transferred to the player’s Backpack.

If it is a server-side Script and not a LocalScript under StarterGui/PlayerGui, it will not run.

Nevermind. I see the problem.

You’re trying to change the BoolValue in the wrong way. When you get the value of a property and store it as a value, you are ONLY getting the value of that property, not the reference to it. So when you set completing = true, all you’re doing is changing the completing variable to equal true, not setting BoolValue.Value to equal true.

What you could do instead is store the BoolValue instance as a variable (rather than BoolValue.Value as a variable) and set it like this

local completing = game.StarterGui.ScreenGui.TextButton.LocalScript.Completing

completing.Value = true
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.