So I've made a gui for owners of VIP Servers only, and when they press 'R' it should make it visible if they're the VIP server owner. But it's not doing anything - No errors either. I have a local script that calls a remote function to get the VIPServerOwnerId, but it's not working. Does anyone know why?

Local Script:

input = game:GetService("UserInputService")
open = false
player = game.Players.LocalPlayer
serverId = script.Parent.vipOwner:InvokeServer()
input.InputBegan:connect(function(input,inOtherInput)
	if inOtherInput ~= true then
		if input.KeyCode == Enum.KeyCode.R then
			print("Invoking")
			print(game.VIPServerOwnerId)
			if serverId == true then
				if open == false then
				script.Parent.Frame.Visible = true
				open = true
				else
					script.Parent.Frame.Visible = false
					open = false
					end
			end
		end
	end
end)

Server Script:

print(game.VIPServerOwnerId)

script.Parent.vipOwner.OnServerInvoke=function(player)
	if player.UserId == game.VIPServerOwnerId then
		return true
	else return false
	end
end

2 comments

0

I'm not sure if you can use a anonymous function for the on server invoke callback. Make a local function called getVipServerOwnerId(player) and use the same code in your anonymous function inside ur new local function and make OnServerInvoke = getVipServerOwnerId

0

I tried and it still didn't work. If it helps I think it's a client issue since it works in studio solo mode.