Code I have so far:
script.Parent.ClickDetector.MouseClick:Connect(function()
script.Parent.ClickDetector.MaxActivationDistance = 0
local TS = game:GetService("TweenService")
local part = script.Parent
local info = TweenInfo.new(1, Enum.EasingStyle.Quint, Enum.EasingDirection.In, 0, true, 0)
local goals = {Position = Vector3.new(17, 5, 43.54),}
local tween = TS:Create(part,info,goals)
tween:Play()
wait(5)
----------------------Don't mind the above, its just the button tweening and stuff
game.Players.LocalPlayer:Kick("get nae naed")
end)
So I'm currently making this really dumb game where there's literally nothing except a baseplate and a button. When you press the button, it's supposed to kick the LocalPlayer out of the server, but it returns nil in the output.
Workspace.button.Script:11: attempt to index field 'LocalPlayer' (a nil value)
When I run the line where it is supposed to kick the player, it works perfectly.
You have been kicked from the game: Get nae naed"
What am I doing wrong?

3 comments
You forgot end)
No. I didn't provide it because I'm not giving him a script. I'm giving him the two pieces he needs to change.
im cool with you not putting the entire thing bc i would have knew to put end) but thx anyways