Local Function Help

Hey DevForum!

I’ve been having a problem with my script that returns " Expected Identifier when parsing variable name got ‘local’ ", I’m not to sure what’s wrong. Can you help me out here?

local function DisableVR()
	if UserInputService.VREnabled then
		LocalPlayer:Kick("Virtual Reality isn't optimised for this experience, please disconnect all VR related devices and rejoin.")
	end
end

(I’ve obviously declared my variables before hand, but here they are if you want them)

local Chat = game:GetService("Chat")
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")

Chat.LoadDefaultChat = true
local LocalPlayer = Players.LocalPlayer

Which line is this exactly happening on?

local function DisableVR()

maybe

function DisableVR()

I tried that already. It didn’t work.

Can you send the code around line 33 of the Essentials script?

1 Like

Then that isn’t the line it’s erroring on. It’s saying it’s a variable. As your local function is correct.

1 Like

I found the solution, it looks like I have an unnamed variable above that I forgot to write, thanks for your help and time.

1 Like

I found the solution, it looks like I have an unnamed variable above that I forgot to write, thanks for your help and time!

1 Like

Glad it was sorted, take care and happy scripting :slight_smile: