Attempt To Index Nil with 'userid'

local admins = {2428180234, 2428233997, game.CreatorId} --UserId of the admins
local reason = game:GetService("ReplicatedStorage"):WaitForChild("SoftShutdown")
	local caller = Caller.UserId
	if table.find(admins, caller) then
		if reason.SoftShutdownReason.Value=="" then
			script.Parent.Text="Enter Reason"
		elseif reason.SoftShutdownReason.Value~="" then

Apparently the error is on the variable caller

Is script.Parent a UI object?
If so, you should get the player from game.Players.LocalPlayer instead.
You are clearly meant to be in a local script, so do it the suggested way instead.

Replace that with:

local caller = game.Players.LocalPlayer.UserId

Also, you should handle the authorization on the server. Otherwise, exploiters can shutdown the server. Do not trust the client.

I am using a script currently to Fire the server, do I still can fire the server in local?? script.parent is a button

You can only FireServer in a local script. UI objects are to be controlled in local scripts.

That worked, thank you so, I am a new dev and I keep forgetting everything

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.