Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why doesn't this find leaderstats script work?

This script should work, I don't know why it doesn't, grateful if anybody can fix it! The parenting is correct, it's located in starterpack Here's a link to what it looks like https://ibb.co/bxbgQa


me = script.Parent.Parent.Parent

if me.Name == game.workspace.Home.OwnerName.Value  then
	if me:findFirstChild("leaderstats") then
if me.leaderstats[script.Parent.Currency.Value].Value>=tonumber(script.Parent.Cost.Value) then
game.ServerStorage["Sword"]:Clone().Parent = me.Backpack 

end

4 comments

0

click the view source thing to view it correctly, because this is not what it looks like

0

me = script.Parent.Parent - That's the correct "me" variable.

0

It's in a model though

0

ALSO - this code worked perfectly fine before I added the 4th and 5th lines so that's obviously where the error is

1 answer

✓ Accepted answer

Would you be nice enough to post any errors? The problem seems to be that you didn't close off all the if's so it is probably erroring over that, if not, then me probably isn't correct, you should be using game.Players.LocalPlayer if it's a server script and you can't do that, you SHOULD be using a LOCAL SCRIPT

This discussion is preserved as it was. New answers, comments, and votes are closed.