Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I have been gone a long time, and FE is confusing me again?

I have this in a server script

game.Workspace.Remote.GiveAdmin.OnServerEvent:connect()
game.Players.PlayerAdded:connect(function(plr)
local admins = {"azurael21", "Doxino", "IcyEvil", "EmperorVolvax"}
for _,v in pairs(admins) do
	if v == plr.Name then
	x =	game.ServerStorage.Bunny:Clone()
	x.Parent = plr.PlayerGui
			end
		end
	end)

and this in a local script

game.Workspace.Remote.GiveAdmin:FireServer()

I can't seem to remember how to script with FilteringEnabled, but I know I should at least be on the right track. Any and all help is appreciated.

2 comments

0

why do you have a PlayerAdded event inside the OnServerEvent ? this will create a new PlayerAdded event each time.

0

It won't work anyways, OP didn't Connect OnServerEvent to any function.

1 answer

✓ Accepted answer

###You are on the right track, the only problem is you didn't Connect OnServerEvent to a function. You won't be needing it anyways. You will need OnClientEvent to edit the PlayerGui.

--Server script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local giveAdmin = ReplicatedStorage:WaitForChild("GiveAdmin")
local admins = {
    [41538450] = true,
    [game.CreatorId] = true
-- Insert the UserId of your admins here. [userid] = true
}

game:GetService("Players").PlayerAdded:Connect(function(plr)
    if admins[plr.UserId] then
        giveAdmin:FireClient(plr)
    end
end)

###Client code:

-- LocalScript, under StarterGui

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local gui = ReplicatedStorage:WaitForChild("AdminGui")
-- Put it in ReplicatedStorage, putting it in server storage makes it inaccessible by client.

local giveAdmin = ReplicatedStorage:WaitForChild("GiveAdmin")
local player = Players.LocalPlayer 
local PlayerGui = player:WaitForChild("PlayerGui")

giveAdmin.OnClientEvent:Connect(function()
    gui:Clone().Parent = PlayerGui
end)

###Hope this helped.

3 comments

0

This most definitely does help, but it doesn't work, it says that I only have permission level 2, and it needs permission level 3?

0

What line?

0

It wasn't saying it was a line, it said it in developer console. Thats all, it just didn't work.

This discussion is preserved as it was. New answers, comments, and votes are closed.