I'm currently making a sheath/unsheath visual that makes a "fake" weapon and places it on the player's back when the weapon is not equipped. I ran into a problem where I have a local script that changes the value of a boolValue and a global script that has a .Changed:Connect() event that is not firing off in response to the boolValue changing. Is this an issue with Roblox or is it an issue with my code? I can see the Value of the boolValue changing in the workspace, but the script isn't registering it.

Here are the parts of the scripts in question.

Localscript:

function onEquipped()
	equipped.Value = true
	hitbox.Transparency = 1
	boxActive.Value = false
end

function onUnequipped()
	equipped.Value = false
	if dancer ~= nil then
		dancer:Stop()
		dancer:remove()
	end
end

Tool.Activated:connect(onActivated)
Tool.Equipped:connect(onEquipped)
Tool.Unequipped:connect(onUnequipped)

Global script:

Tool.equipped.Changed:Connect(function(NewValue)
	print "fire"
	local fake = real:Clone()
	local root = playeractual.Character:FindFirstChild("UpperTorso")
	local attachpoint = root.Sheathpos
	local weld = attachpoint.Sheathweld
	fake.Parent = root
	fake.Position = attachpoint.Position
	weld.Part1 = fake
	weld.C1 = CFrame.Angles((math.pi/4)* -1,math.pi/2,math.pi)+ Vector3.new(-0.75,0,-0.5)
	if NewValue == true then
		fake.Transparency = 1
	elseif NewValue == false then
		fake.Transparency = 0
	end
end)

3 comments

0

Changes made by the client cant be seen by the server. Thats filtering enabled. You'll need to use a remote event to achieve this.

0

I'd recommend setting up a remote event that fires from the client to the server script in place of the bool value you currently have implemented.

0

I'll look into that. Thank you.