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

Could someone help troubleshoot my script?

So I have this script, where you enter the name of a Player, then a reason, using TextBox's.

I will post what output says below:

script.Parent.MouseButton1Click:connect(function()
plr=script.Parent.Parent.Parent.Parent.Parent.Parent
theplayer = script.Parent.Parent.Name.Text
HR=plr.Name
reason = script.Parent.Parent.Reason.Text
if game.Players:FindFirstChild(theplayer) ~= nil then
	
print("foundplayer")
theplayer.PlayerGui.Warning.Frame.Visible=true
theplayer.PlayerGui.Warning.Frame.Part1.Text="You have been given a warning by "..HR..", if you continue to break the rules, you may be banned from the event"
theplayer.PlayerGui.Warning.Frame.Part2.Text="Reason for the warning: "..reason
elseif game.Players:FindFirstChild(theplayer)==nil then
print("CouldntFindEm")

end

end)

18:06:26.265 - Argument 1 missing or nil

18:06:26.266 - Script 'Players.Player1.PlayerGui.HRWarn.Frame.Frame.TextButton.Scr', Line 6

18:06:26.267 - Stack End

18:06:26.267 - Disconnected event because of exception

1 answer

✓ Accepted answer

Please upvote my rep and/or mark this as the correct answer is this worked or helped you.

The error is saying that the value of theplayer is nil, and this is probably nil because the path to it is incorrect. Perhaps too many .Parents, or too little?

5 comments

0

The path is correct.

0

Are you able to list what the explorer says?

0

Actually, I figured it out. I named a textbox "Name" and it is messing up. Thanks for your help.

0

Oh... no problem :) I suspected the path was wrong.

0

What happened was the textbox was called "Name" but it was checking the Frame's name, then text, which of course is nil.

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