Group Locked button not working

I am trying to load in gun engines, without the grouplocked script it works perfectly, but I wish to make them group locked and it seems like every time I do I press the button and it still just does the coding with taking into consideration the actual grouplocked part itself, with this it also reloads the gun engine thats already loaded instead of loading the unloaded one.

--CE Variables
CEServer = game.ServerScriptService.Carbon_SEngine
CEGui = game.StarterGui.Carbon_CEngine

--ACS Variables
ACSServer = game.ServerScriptService.ACS_Server
ACSClient = game.StarterPlayer.StarterCharacterScripts.Saude.ACS_Client
CETool = game.ServerScriptService["CEAR-15"]:Clone()
CETool1 = game.ServerScriptService["CEAR-15"]:Clone()
ACSTool = game.ServerScriptService["AR-15"]
local plr = game.Players.LocalPlayer
local button = script.Parent
local minrank = 255
local groupid = 16968869

button.MouseButton1Click:Connect(function()
	if plr:GetRankInGroup(groupid) >= minrank then
		CEServer.Enabled = true
		CEGui.Enabled = true
		ACSServer.Enabled = false
		ACSClient.Enabled = false
		CETool.Parent = game.Teams["Team 1"]
		CETool1.Parent = game.Teams["Team 2"]
		ACSTool.Parent = game.Teams["Team 1"]["AR-15"]:Destroy()
		ACSTool.Parent = game.Teams["Team 2"]["AR-15"]:Destroy()
	end
end)
1 Like

To be honest, I am not sure what you trying to do? Like ACSTool Parent and then destroy?

1 Like

Don’t worry about that, I am just trying to make it group locked, the coding is fine but the group lock part doesn’t work.

1 Like

are you really trying to use a local script to take something from the serverscriptservice and clone to the player…

1 Like

its not a local script, its running as the server

1 Like

now can u help me or continue to be a npc?

1 Like

“local plr = game.Players.LocalPlayer” is client sided script … not normal script
bet your lacking of scripts informations to can help more

2 Likes

then what code for server,cus ive done everything

1 Like

i would recommend you to move the tools too server storage since serverscriptservice is not made to store models/parts but only to work with scripts, and can you provide more informations of how you want it to work, like with a UI or something else

1 Like

it works fine, server storage is bugging out cus roblox is broke, so for now i just need it to be group locked and if i am in the group it continues to run the script and if i am not in the group it doesnt run it

1 Like

so in what you told , you are telling to the script gives the tool to “owner only” since rank “255” is the group owner rank and no one else, and give that person the tool

1 Like

do u got discord? its easier if i just show u

1 Like

sorry but i don’t give it , since it’s against roblox tos to share other social medias. if you want send me a dm

1 Like

well it doesnt matter, the coding works fine without the group lock, i dont need to mess with the coding for the gun engines, i just need the group lock to work

1 Like

well it doesnt matter, the coding works fine without the group lock, i dont need to mess with the coding for the gun engines, i just need the group lock to work, is there anywhere to do that?

just to ask are you using a GUI to give the player the tools?
if no then use this in serverscriptservice as a serverscript

-- CE Variables
local CEServer = game.ServerScriptService.Carbon_SEngine
local CEGui = game.StarterGui.Carbon_CEngine

-- ACS Variables
local ACSServer = game.ServerScriptService.ACS_Server
local ACSClient = game.StarterPlayer.StarterCharacterScripts.Saude.ACS_Client
local CETool = game.ServerScriptService["CEAR-15"]:Clone()
local CETool1 = game.ServerScriptService["CEAR-15"]:Clone()
local ACSTool = game.ServerScriptService["AR-15"]
local minRank = 255
local groupId = 16968869

local function giveTool(player)
    CEServer.Enabled = true
    CEGui.Enabled = true
    ACSServer.Enabled = false
    ACSClient.Enabled = false
    CETool.Parent = game.Teams["Team 1"]
    CETool1.Parent = game.Teams["Team 2"]
    ACSTool:Destroy()

    -- Give the tool to the player
    local tool = CETool:Clone()
    tool.Parent = player.Backpack
end

game.Players.PlayerAdded:Connect(function(player)
    if player:GetRankInGroup(groupId) >= minRank then
        giveTool(player)
    end
end)

-- Give the tool to existing players when the script runs
for _, player in ipairs(game.Players:GetPlayers()) do
    if player:GetRankInGroup(groupId) >= minRank then
        giveTool(player)
    end
end

it would be so much easier if you could just add me and i can explain in vc code_s2

send me your dc will send request then

code_s2 is my dc, thats the new tag system just add it in the friend request bar

Why don’t you just make a team for the groups, put all group members in 1 team and all non in the other, and then give the gun as a startertool of team?