-
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.
-
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.
-
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
loadSlot(framework.currentSlot)
else
framework.module.currentSight = "IronSight"
framework.viewmodel.Attachments:FindFirstChild("IronSight").Transparency = 0
loadSlot(framework.currentSlot)
end
end
end