local Name = game.Players.Name
local Input = script.Parent.Parent.Parent.Input.Text
local Reason = script.Parent.Parent.Parent.Reason.Text
script.Parent.MouseButton1Click()
if Input == Name then
local WarnText = Instance.new('TextLabel')
local Punishments = Instance.new('ScreenGui')
Punishments.Parent = game:GetService('Players').Input:WaitForChild('PlayerGui')
WarnText.Parent = Punishments
WarnText.Visible = false
WarnText.BackgroundColor3 = {0,0,0}
WarnText.BackgroundTransparency = {0.5}
WarnText.BorderSizePixel = 0
WarnText.Position = {0.5, 0}
WarnText.Size = {500,50}
WarnText.Font = Enum.Font.GothamSemibold
WarnText.TextColor3 = {255,255,255}
WarnText.Text = 'Warned for reason: '..Reason
game:GetService('Players').Input:WaitForChild('PlayerGui').WarnText.Visible = true
wait(5)
game:GetService('Players').Input:WaitForChild('PlayerGui').WarnText.Visible = false
end
What I want this script to do is when a valid playername has been inputted in the TextBox named 'Input' and with a reason inputted the TextBox named 'Reason' I want it to create a new instance of a textlabel and make it visible to the warned player's PlayerGui
Though as I try and warn a player, nothing shows up
https://imgur.com/rg0BO30 - A reference for the location of objects
What's wrong with my script? Hopefully it makes sense

5 comments
I'm confused on where I should be writing these lines and change my script, could you elborate a bit more?
All of the code I have provided would go in your local script. The function PlayerExists would need to be before your "if Input == Name" statement. Then, you would change that if statement to "if PlayerExists(Input) then" to check if the player exists. As for the server script you create you need to look into remote events. https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events
If you still don't understand something let me know
Ah right, thanks for the elaboration.
Sure! If this fixed your problem, please mark my answer as the solution. :)