FPS Framework Attachment Troubles-

  1. What do you want to achieve? I would like to make an attachment system for my FPS Framework where you can attach sights onto your guns, though there have been some issues. The view models have a folder inside of them, which has the attachments in it.

  2. What is the issue? The attachments do not work, I have a block of code later in the script where you trigger a proximity prompt, setting off the SwapAtt() function, and a line of code that prints the current attachment to the output. The ‘currentSight’ does not get changed, and the attachment doesn’t change its transparency.

  3. What solutions have you tried so far? I’ve tried to solve it myself and ask my developer friends if they could figure it out, though they didn’t know.

(I’m not the best at scripting, so if it’s a simple solution I apologize.)

function SwapAtt()
	for i, v in pairs(workspace.Triggers.Attachments:GetDescendants()) do
		if v:IsA("StringValue") and v.Parent:IsA("ProximityPrompt") and v.Name == "AttVal" and framework.module and framework.module.attachments.currentSight == "IronSight" then
			framework.module.currentSight = v.Value
			framework.viewmodel.Attachments:FindFirstChild(framework.module.attachments.currentSight).Transparency = 0
			framework.module.currentSight = "IronSight"
			framework.viewmodel.Attachments:FindFirstChild("IronSight").Transparency = 0
1 Like

An Attachment defines a point and orientation relative to a parent BasePart or another Attachment. The offset is stored in the CFrame property.
- From Attachment | Documentation - Roblox Creator Hub

So use Attachments to organize Attachments, not Folders.

Sorry, I didn’t mean attachment as in an actual Roblox attachment object, but attachment as in the name of the sight, on the gun.