New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
1

How would I verify this serversided?

Asked by 3 months ago
Edited 3 months ago

I'm making a command script for a training place, how would I verify if the player is in the group server sided? Like a check if the player is in a certain group at a certain rank. People with exploits fire this remote a lot.

Client
game.Players.LocalPlayer.Chatted:connect(function(msg)
    local player = game.Players.LocalPlayer
    local rank = player:GetRankInGroup(474547)
    if rank >= 10 then
if  msg:sub(1,6)==":load " then
            local map = msg:sub(7,msg:len())
            print(map)
            game.ReplicatedStorage.Events.LoadMap:FireServer(map)
        end
Server
game.ReplicatedStorage.Events.LoadMap.OnServerEvent:connect(function(player,map)
    local bricks = game.ServerStorage.Maps:FindFirstChild(map) 

1 answer

Log in to vote
2
Answered by 3 months ago
Edited 3 months ago

Nesting the Chatted Event


What you can do is just nest the chatted event inside a playeradded event and handle the entire thing on the server.

Like such:

game.Players.PlayedAdded:Connect(function(plr)
    plr.Chatted:Connect(function(msg)
        local rank = player:GetRankInGroup(474547)
        if rank >= 10 then
            if msg:sub(1,6) ==":load " then
                local map = msg:sub(7,msg:len())
                local bricks = game.ServerStorage.Maps:FindFirstChild(map) 
            end
        end
    end)
end)

Hopefully this helped!

0
tysm think145 7 — 3mo
Ad

Answer this question