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

How would I verify this serversided?

Asked by 4 years ago
Edited 4 years 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 4 years ago
Edited 4 years 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 — 4y
Ad

Answer this question