Loadout system wont detect changes in player's primary/secondary values

I am designing a loadout system for one of my games, and have encountered a roadblock(s)

this script is in server script service, and even when i can see in the explorer that the specific values did change, the code prints the old ones and wont give the player the tools they have set because of it

code:


game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local primary = plr.Primary.Value
		local secondary = plr.Secondary.Value
		print(primary,secondary)
		local primarytool = rep.Tools.Primaries[primary]
		local secondarytool = rep.Tools.Secondaries[secondary]
		if primarytool then
			wait(0.1)
			primarytool:Clone().Parent = plr.Backpack
		end
		if secondarytool then
			wait(0.1)
			secondarytool:Clone().Parent = plr.Backpack
		end
	end)
end)```

![image|460x24](upload://a7dOC5hwW1h5tuGOZ6rGJGMiSo.png)

![image|340x87](upload://bhYyc0WoatXsJmuOLjgXt9dWSMW.png)

![image|364x94](upload://6Wb8iuhSPJJ086FFxoiLglRh790.png)

can someone help me understand whats wrong?

I’m assuming you are changing the Primary and Secondary values from the client. Make sure you are using a RemoteEvent to send the chosen tools to the server before you reset your charcter.

image
image
image

ohhhh that makes so much sense, thank you for pointing out my blindness ;-;

thank you so much, that was my problem T-T

1 Like

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