boolValue not replicating outside of script

I have a fairly simple script that rotates a switch when you click on it, then changes a boolValue located inside of the model. However, the boolValue doesn’t replicate anywhere outside of the script itself, not to the client, nor to the server. This is in a regular script inside of the workplace. The switch itself does rotate and replicates across to the server.

local switch = script.Parent.Switch
local sounds = script.Parent.Parent.Parent.Main
local IsActive = script.Parent.IsActive.Value

function onClick()
	if not IsActive then
		switch:SetPrimaryPartCFrame(CFrame.new(Vector3.new(-35.93, 5.161, -53.79)) * CFrame.Angles(0, math.rad(180), 0))
		sounds.Switch:Play()
		IsActive = true
	end
end

switch.MeshPart.ClickDetector.MouseClick:Connect(onClick)
1 Like
local switch = script.Parent.Switch
local sounds = script.Parent.Parent.Parent.Main
local IsActive = script.Parent.IsActive

function onClick()
	if not IsActive.Value then
		switch:SetPrimaryPartCFrame(CFrame.new(Vector3.new(-35.93, 5.161, -53.79)) * CFrame.Angles(0, math.rad(180), 0))
		sounds.Switch:Play()
		IsActive.Value = true
	end
end

switch.MeshPart.ClickDetector.MouseClick:Connect(onClick)

Try now :slight_smile:

1 Like

You’re a genius m8, thanks for helping!

1 Like