game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character)
if classofplr.Value == "RKR" ~= nil then
local musket = serverstorage:WaitForChild("Musket"):Clone()
musket.Parent = player.Backpack
if classofplr.Value == "SHS" ~= nil then
local rifle = serverstorage:WaitForChild("Rifle"):Clone()
rifle.Parent = player.Backpack
end
end
end)
end)
we need a rbxl file to see whats going on
1 Like
I would prefer showing you the output or screenshots of what happened.
There’s a couple of things. The main one being that the bool algebra (thing == “string” ~= nil) will always evaluate true. You’d need to add an and clause, although anything that passes == “string” will never be nil, so seems very unnecessary.
If you’re evaluating the “SHS” and “RKR” classes as separate you might want to consider elseif statements:
if classofplr.Value == "RKR" then
local musket = serverstorage:WaitForChild("Musket"):Clone()
musket.Parent = player.Backpack
elseif classofplr.Value == "SHS" then
local rifle = serverstorage:WaitForChild("Rifle"):Clone()
rifle.Parent = player.Backpack
end
1 Like