I’ve been working on this Attachment system and after adding a Prebuilt gun System I ran into a weird Issue.
the way my Attachment System works is that, when Player Equips the tool it grabs Settings a Table located inside the Weapons Settings (ModuleScript)
the way Viewmodel works is when Player Equips a tool, it goes through the tool and grabs the gun Settings.
then my Attachment System looks through the Attachment part of the Settings and Adds parts.
^client
on Server it does the same thing it Requires the Settings Module checks attachments clones them.
Attachment Part of the settings looks like this:
Attachments = {
Muzzle = {
---attachment info...
},
---other attachments...
}
the Attachment system was working well until I decided to add Prebuild weapons (it changes Attachments to a Premade Setting, from Server). There aren’t any Errors, but I noticed That the Client Module of the gun is Different from the Server Module?
to sum it up, the issue is Changing the Module on Server doesn't change it for client.
Video Example of the Issue:
Gun giver script:
Model.Prox.ProximityPrompt.Triggered:Connect(function(Player)
if not Player.Backpack:FindFirstChild(WeaponName) and not Player.Character:FindFirstChild(WeaponName) then
local WeaponPrebuilds = HttpService:JSONDecode(PlayerData:WaitForChild(WeaponName).Value)
local Tool = ServerStorage.Tools:FindFirstChild(WeaponName):Clone()
local ACS_Module = require(Tool:WaitForChild("ACS_Module"):WaitForChild("Variables"):WaitForChild("Settings"))
ACS_Module.Attachments = WeaponPrebuilds[SelectedPrebuild.Value]
ACS_Module.Used = false
Tool.Parent = Player.Backpack
warn("Server Settings-------")
warn(Tool)
warn(ACS_Module)
end
end)
Snippet of the client function that defines gun Settings:
function Setup(Tools)
ArmaClient = Tools
ArmaClone = GunModels:WaitForChild(ArmaClient.Name):Clone()
Var = Tools.ACS_Module.Variables
Settings = require(Var:WaitForChild("Settings"))
warn("Client Settings ------")
warn(ArmaClient)
warn(Settings)
Anims = require(Var:WaitForChild("Animations"))
end
what gun Settings look like:
return = {
--settings
}
could this Issue be caused by a script? or am I doing something wrong?
if you are confused about anything I apologize, English is not my first language and I do kind of suck with Explaining stuff, don’t hesitate to ask questions.
I have tried making a Remote Event function that would Return Module Setting but the Remove Event was delayed. it didn’t return until the Setting was required and it only returned after Client Sided function gave an error