When a player purchases a sword, it gets added to their “OwnedSwords” folder as a StringValue
and the name of the sword is set as the StringValue
name.
I have a function that checks if the player owns the sword when they join, and if they do not it should print "Does not own Spartan Sword"
However, it does not print anything out, please be mindful that this is a LocalScript. I’ve provided the function code below, any advice or insight on how I could resolve this issue would be greatly appreciated, thanks.
local function checkforOwnership(player)
if player:WaitForChild("OwnedSwords"):FindFirstChild("Spartan Sword") then
print("Owns: Spartan Sword")
equipButton.Visible = true
else
print("Does not own: Spartan Sword")
end
end
game.Players.PlayerAdded:Connect(function(player)
checkforOwnership(player)
end)
There are also no errors in the output for this, if you were wondering.