PrimaryWeaponEvent.OnServerEvent:Connect(function(player, Value)
if Value == 1 then
CoolValue.Value = 1
elseif Value == 2 then
CoolValue.Value = 2
elseif Value == 3 then
CoolValue.Value = 3
end
end)
I would say that there’s not much else you can do to make sure CoolValue gets the proper value. What you are doing is very common and basic. I wouldn’t be surprised if there were other alternatives to this.
I just noticed that this is a bit unoptimized. Try clamping and rounding the value. math.clamp makes it so the number given is within a range, and math.floor basically cuts out the decimal part of the value.
PrimaryWeaponEvent.OnServerEvent:Connect(function(player, Value)
Value = math.floor(math.clamp(Value, 1, 3))
CoolValue.Value = Value
end)