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

Please help me, I cant call a function when my BoolValue changed.(?)

I have a problem with my script, I'm trying to call a function when my BoolValue(LocalPartEnabled) changed, but I'm getting an error says " 12:38:50.364 - LocalPartEnabled is not a valid member of ServerStorage" I put the screenshot..

Can you help me please?

Thanks...

Screenshot links:

Link 1 Link 2(Alternative)

1 answer

Try this:

local LocalPlayer = game:GetService("Players").LocalPlayer
local ServerStorage = game:GetService("ServerStorage")
local LocalPartEnabled = ServerStorage:WaitForChild("LocalPartEnabled")
local LocalPartValue = ServerStorage:WaitForChild("LocalPartValue")

LocalPartEnabled.Changed:Connect(function(newEnabledValue)
	if newEnabledValue then
		if LocalPlayer == LocalPartValue.Value then
			print("Successful...")
		end
	end
end)

Use variables for more organized scripts, and :WaitForChild() to avoid this kind of errors.

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