Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I make this serverscript FE compatible? [Help?]

Asked by 5 years ago
Edited 5 years ago
--//Variables
local AdminModule = require(game:GetService("ReplicatedStorage").AdminModule)
--//Main
game.Players.PlayerAdded:Connect(function(player)
    --//Variables
    local PlayerGui = player.PlayerGui
    local AdminPanel = PlayerGui:WaitForChild("AdminPanel",7)
    local Main = AdminPanel.Main
    local PlayerData = Main.PlayerData
    local MainFunctions = Main.MainFunctions
    local Playerlist = Main.Playerlist

    --//Admin Checking & Handling
    if AdminModule.checkAdmin(player.Name) == true then 

        MainFunctions.ResetData.MouseButton1Click:Connect(function()
            local PlayerSelected = AdminModule.getSelected(player)
            if PlayerSelected == nil then
                print("Player has not been selected!")
            else
                game.Players[PlayerSelected].PlayerData.Level.Value = 1
                game.Players[PlayerSelected].PlayerData.XP.Value = 0
                game.Players[PlayerSelected].PlayerData.NeededXP.Value = 1000
                game.Players[PlayerSelected].PlayerData.Money.Value = 0
                game.Players[PlayerSelected].PlayerData.Rebirth.Value = 0
                game.Players[PlayerSelected].PlayerData.XPRate.Value = 1
                wait(1)
                game.Players[PlayerSelected]:Kick("Your data has been reset for various reasons. Please rejoin!")
            end             
        end)        
        MainFunctions.AdminTool.MouseButton1Click:Connect(function()
            --don't really got an admin tool exdee
        end)

        MainFunctions.Shutdown.MouseButton1Click:Connect(function()
            for i,v in pairs(game.Players:GetChildren())do
                v:Kick("Server has been shutdown. Please rejoin!")
            end
        end)

        MainFunctions.KickPlayer.MouseButton1Click:Connect(function()
            local PlayerSelected = AdminModule.getSelected(player)
            if PlayerSelected == nil then 
                print("Player not selected")
            else
                game.Players[PlayerSelected]:Kick("Kicked by an admin!")
            end
        end)

        Main.PlayerData.AdminTool.MouseButton1Click:Connect(function()
            --ignore this
        end)
    else
        player:Kick("You shouldn't have access to this panel. If you found a bug, please report it for possible in-game items!")
    end
end)

Basically, it doesn't work in-game. I'm trying to make an admin panel but now it doesn't work. Everything works fine on Studio but not in-game. The game is FE, so maybe that's a problem? If so, how would I make this compatible with FE. This is a server script in ServerScriptService. I know I could use Remote Events but I feel it's not that safe... I wanna have it serverside

0
what you should do is use Remote Events and runthe MouseButton1Click events in gui in a local script. PlaasBoer 275 — 5y
0
Yes, but it's an admin panel type thing. I wanna do it serverside... Sharkeedub 179 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

To make that thing be FE-Compatible, all you need to do is to use RemoteEvents in sending the variables (just like what PlaasBoer said)

Your main concern is that you want to do it serverside. A very important thing to remember in keeping your game secure is to never trust the client with anything. What I would do for this is to check the player if they are actually admins in-game, give them the admin panel things, make those admin panel things fire the RemoteEvent when used, and the most important of all, make the server check if the player is really authorized to use the admin panel.

0
Oh alright. I just wanna make sure. Can they somehow trick the server into thinking their the admin? Sharkeedub 179 — 5y
0
But kind of sucks now. I'm going to have to rewrite some of it. Eh won't take too long. I got the base of the code done. Sharkeedub 179 — 5y
Ad

Answer this question