Best way to make RopeConstraints invisible to LocalPlayer

I have a “Hat” accessory that I am adding to the player’s character, it is a necklace where the string is made of RopeConstraints. It looks really good on the server-side.

However… my game is a first-person view game. The RopeConstraints end up blocking the player’s view.

I have tried adding a Local Script to this accessory to make the RopeConstraints invisible to the local player, but when I change the Visible property of the RopeConstraints from the LocalScript, they are still visible from the first-person view. I have also tried to entirely :Destroy() the necklace from this Local Script to remove it from the player’s view, this does not work either and the RopeConstraints still are visible.

What is the best way I can handle this so that the necklace does not block the first-person view?

Here is what the Accessory looks like:
image

All the Attachments and RopeConstraints that are children of these parts are just used to link the ropes together into a “necklace” shape.

Put a localscript in the startercharacterscripts folder with this code :

local InFirstPerson = false
local Head = script.Parent:WaitForChild("Head")

local RopesList = {
	Rope1 = "Location to your rope",
	Rope2 = "Location to your rope",
	Rope3 = "Location to your rope",
	Rope4 = "Location to your rope",
	Rope5 = "Location to your rope"
		}

local function Update()
	Head:GetPropertyChangedSignal('LocalTransparencyModifier'):Connect(function()
		if Head.LocalTransparencyModifier == 1 then
			if InFirstPerson == false then
				InFirstPerson = true
				for i, Rope in RopesList do
					Rope.Enabled = false
				end
			end
		else
			if InFirstPerson == true then
				InFirstPerson = false
				for i, Rope in RopesList do
					Rope.Enabled = true
				end
			end
		end
	end)
end

game["Run Service"].RenderStepped:Connect(Update)

I hope this will work for you

The way my game works, different necklaces can be equipped/unequipped, they are cloned from the server-side to the player’s Character, using :AddAccessory(). Is there a way I could have this script as a child of the accessory, and be run when the accessory becomes parented to the player’s Character, rather than checking for rope constraints on every rendered frame?

I am going to try to set it up this way based on your response.

I got this to work with a Remote Event. When the necklace is equipped from the server side, i set it up to also fire a function in the LocalScript that is inside of the necklace accessory.

(This LocalScript is a child of Handle)

local HideNecklaceRopeConstraintsEvent = game:GetService("ReplicatedStorage"):WaitForChild("HideNecklaceRopeConstraints")
local accessory = script.Parent.Parent

local function onEquippedEvent()
	for i, v in ipairs(script.Parent:GetChildren()) do
		if v:IsA("RopeConstraint") then
			v.Thickness = 0
		end
	end
end

HideNecklaceRopeConstraintsEvent.OnClientEvent:Connect(onEquippedEvent)

Glad you got it to work! Hope i was helpful!

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