Help on Gui Submit Kick

I want to make it so when a Player clicks the Submit Button, it kicks them!

It won’t work the way I did it, here’s the error.
14:59:00.427 - Players.Diguard.PlayerGui.ApplicationGui.ApplicationMainFrame.SubmitButton.Script:3: attempt to index local ‘Player’ (a nil value)

I tried looking for some tutorials on YouTube, but I couldn’t find anything.

If anyone can help, it would be awesome!

function OnClick(Clicked)
	local Player = game.Players:GetPlayerFromCharacter(Clicked)
	Player:Kick("Successfully Submitted Application!")
end

script.Parent.MouseButton1Click:Connect(OnClick)

If this is in a GUI you should not get the player like that try using local player = game.Players.LocalPlayer.

15:22:26.771 - Players.Diguard.PlayerGui.ApplicationGui.ApplicationMainFrame.SubmitButton.Script:3: attempt to index local ‘Player’ (a nil value) Still says it’s a Nil Value.

Can you please share and image of your script?

https://gyazo.com/1752f8d1240fc700b34a9c829a78f910

Yep!

Now I see it, you put this code in a regular script. Try copying the code deleting the script and replacing it with a LocalScript and copying the code in that. You can not manipulate GUI with a Script.

It worked, thank you so much, I appreciate it!

Welcome this is all pretty basic stuff I know it might be annoying but going through a couple beginner tutorials should help.

Alright, have a nice day, bye!