so I did a client-server communication where the server will be setting up the attributes for the ammo and magazine. the code below is the serverscript that setup attributes
signal:OnEvent("InitGun", function(plr, tool)
local weapon = framework.new(tool, plr.Character)
if not tool:GetAttribute("Ammo") and not tool:GetAttribute("Magazine") then
print("Setting up attributes")
tool:SetAttribute("Ammo", weapon.Configuration.Ammo)
tool:SetAttribute("Magazine", weapon.Configuration.Magazine)
end
print(tool:GetAttribute("Ammo"))
print("Server initialized")
end)
for some reason, it is printing nil on the server
but still shows up on the client. I need assistance with this. it might be a stupid error I made, but I’m still unaware of the problem. thanks!
yes I did fire the event. not sure why’s that the reason, because the last time I did this it was working fine.
char.ChildAdded:Connect(function(child)
if child:IsA("Tool") then
signal:FireServer("InitGun", child)
weapon = framework.new(child)
status = weapon.Status
end
end)
Speaking from my own experience, sending more than one argument can get disorienting for the code. To check if your arguments are being sent correctly, can you run the following?
Sending the arguments
char.ChildAdded:Connect(function(child)
if child:IsA("Tool") then
print(child)
signal:FireServer("InitGun", child)
...
…yeah I completely have the wrong path for the Ammo and Magazine just like what @Demo_Liti0n and @Judgy_Oreo said. should’ve done more debugging next time. thanks for your answers everyone!