You can write your topic however you want, but you need to answer these questions:
Im trying to make it so if a player has enough points they can tp to a diff place but if they dont a GUI pops up. I have no idea whats wrong with it, it says somthing is wrong with line 9 here is a screenshot
ive tried having it just tp and it worked, ive tried making it print the players name and that worked but for some reason, it dont know what leaderstats is, i have a saving leaderstats on spelt exactly the same. here is the code
local Silver = script.Parent.Parent.Parent.TeleportTwo.PartTwo
script.Parent.Touched:Connect(function(hit)
if hit.Parent ~= nil then
local nam = hit.Parent
local Pname = game.Players:FindFirstChild(nam)
wait(0.1)
if Pname.leaderstats.Points >= 90 then
nam:MoveTo(Silver.Position)
else
game.StarterGui.PopUp.One.Enabled = true
end
end
end)
You haven’t provided any stack traces or what is going wrong except “something is wrong on Line 9” - and I have no idea what line 9 is (relative to your main script? or Line 9 in the code snippet you’ve sent?)
Can you please provide that information so I can help you. (Also, if you want people to read your thread, name it something descriptive - not just “I need help”)
In your script you check if the part that touched the block has a parent, not if the part is a character. You should make sure that the object is a character before trying to access it’s player and leaderstats.
As an alternative, you can change your if statement to
If you would like to get your script working, it would be worth providing the information I have requested, as it is physically impossible to assist you with the information you have provided.
I am so sorry, I really dont know how to ask for help, can you like tell me what you need? and all that the thing is saying is that there is somthing wrong with line 9 and its about the leaderstats