Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Could someone help troubleshoot my script?

Asked by 9 years ago

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

Log in to vote
1
Answered by 9 years ago

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?

0
The path is correct. Tempestatem 884 — 9y
0
Are you able to list what the explorer says? Basscans 60 — 9y
0
Actually, I figured it out. I named a textbox "Name" and it is messing up. Thanks for your help. Tempestatem 884 — 9y
0
Oh... no problem :) I suspected the path was wrong. Basscans 60 — 9y
0
What happened was the textbox was called "Name" but it was checking the Frame's name, then text, which of course is nil. Tempestatem 884 — 9y
Ad

Answer this question