Ad
Log in to vote
1

How come my money give command wont work. What's happening?

Asked by 4 days ago
Edited 4 days ago

--//Description\--

I have 2 scripts. One called AdminHandler and another called Controller. I know Controller sends the data I need to send but the admin handler won't run the command. Whats happen?

--//AdminHander\--

local admins = {
---UserNames
    ["vincentthecat1"] = 1;
    ["Havok_Ninja"] = 2;
    ["EatSomeSand123"] = 3;
    [""] = 4;
---UserId's
    [150334552] = 1;
    [21010010] = 2;
    [896303435] = 3;

}

local manualBans = {
---UserNames
    ["AntiHaxRemover"] = 1;
    ["ROBLOX_GM"] = 2;  
---UserId's
    [1097804958] = 1;
    [112646950] = 2;
}

---MoneyAdd Command
game.ReplicatedStorage.AdminEvents.AddMoneyEvent.OnServerEvent:Connect(function(player, victim, amount) ---Won't work.
    if admins[player.Name or player.UserId] then

        local foundGive = game.Players:FindFirstChild(victim)
        local give = script.AddAmount.Value

        if foundGive then
            give = amount
            foundGive.leaderstats.Cash.Value = foundGive.leaderstats.Cash.Value +give
        end
    end
end)    

---ChatTag
game.Players.PlayerAdded:Connect(function(player)
    if admins[player.Name or player.UserId] then
        local tags = {
            {
                TagText = "?????????",
                TagColor = Color3.fromRGB(107, 50, 124)
            }
        }
        local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner").ChatService)
        local speaker = nil
        while speaker == nil do
            speaker = ChatService:GetSpeaker(player.Name)
            if speaker ~= nil then break end
            wait(0.01)
        end
        speaker:SetExtraData("Tags",tags)
        speaker:SetExtraData("ChatColor",Color3.fromRGB(161, 94, 13))
    end
end)

---AutomaticBans
game.Players.PlayerAdded:Connect(function(player)
    if manualBans[player.Name or player.UserId] then
        player:Kick("You are automaticly banned as you have a history of exploting.")
    end
end)

game.Players.PlayerAdded:Connect(function(player)
    if admins[player.Name or player.UserId] then
        local clone = script["AdminPanel"]:Clone()
        clone.Parent = player.PlayerGui
    end
end)

---ServerBan Command
game.ReplicatedStorage.AdminEvents.ServerBanEvent.OnServerEvent:Connect(function(player1, victim1, reason1)
    if admins[player1.Name or player1.UserId] then

        local found = game.Players:FindFirstChild(victim1)
        local foundClone = script.victimName:Clone()

        if found then
            foundClone.Parent = game.Workspace.ServerBans
            foundClone.Name = found.Name
            foundClone.Value = found.UserId
            found:Kick("You have been banned by ".. player1.Name.. " for " ..reason1 ..".")
            game.ReplicatedStorage.AdminEvents.PlayerServerBannedEvent:FireAllClients(victim1)
        end
        game.Players.PlayerAdded:Connect(function(player)
            if game.Workspace.ServerBans:FindFirstChild(player.Name) then
                player:Kick("You are banned from this server.")
                game.ReplicatedStorage.AdminEvents.PlayerServerBannedEvent:FireAllClients(victim1)
            end
        end)
    end
end)        

---Kick Command
game.ReplicatedStorage.AdminEvents.ServerKickEvent.OnServerEvent:Connect(function(player2, victim2, reason2)
    if admins[player2.Name or player2.UserId] then

        local foundKick = game.Players:FindFirstChild(victim2)

        if foundKick then 
            foundKick:Kick("You have been kicked by ".. player2.Name.. " for " ..reason2 ..".")
            game.ReplicatedStorage.AdminEvents.PlayerKickedEvent:FireAllClients(victim2)
        end
    end
end)

---GlobalBan Command
game.ReplicatedStorage.AdminEvents.GlobalBanEvent.OnServerEvent:Connect(function(player3, victim3, reason3)
    if admins[player3.Name or player3.UserId] then

        local foundGlobal = game.Players:FindFirstChild(victim3)

        if foundGlobal then
            foundGlobal.GlobalBan.Value = true
            foundGlobal:Kick("You have been banned by ".. player3.Name .." You have been banned from the game, due to our moderators finding you unfit to play.")
            game.ReplicatedStorage.AdminEvents.PlayerGlobalBannedEvent:FireAllClients(victim3)
        end
        game.Players.PlayerAdded:Connect(function(player)
            if player.GlobalBans.Value == true then
                player:Kick("You have been banned from the game, due to our moderators finding you unfit to play.")
                game.ReplicatedStorage.AdminEvents.PlayerGlobalBannedEvent:FireAllClients(victim3)
            end
        end)    

---Age kicking
        local minimumAge = 25
        game.Players.PlayerAdded:Connect(function(player)
            if(player.AccountAge < minimumAge) then
                player:Kick("Your account must be at least "..tostring(minimumAge).." days old to play this game!")
            end
        end)
    end
end)

---PlayerJoined
game.Players.PlayerAdded:Connect(function(player)
    game.ReplicatedStorage.AdminEvents.PlayerJoin:FireAllClients(player.Name)
end)

--//AdminHander\--

local gui = script.Parent
local frameOutLine = gui.AdminPanelOutline
local adminFrame = frameOutLine.AdminPanel
local moderationframe = adminFrame.ModerationFrame
local UserBoard = frameOutLine.UserBoard.UserNames
local moneyFrame = frameOutLine.MoneyFrameOutline
local moneyPanel = moneyFrame.MoneyFrame
local inputAmount = moneyPanel.MainFrame.InputAmount
local moneyConfirm = moneyPanel.MainFrame.MoneyConfirm
local moneyFrameOpen = frameOutLine.MoneyFrameOpen
local moneyFrameClose = moneyFrame.MoneyFrameClose

local flag = false
local flag2 = true

game.ReplicatedStorage.AdminEvents.PlayerJoin.OnClientEvent:Connect(function(playerName)

    local clone = script.TextButton:Clone()

    local UIS = game:GetService("UserInputService")
    local GuiService = game:GetService("GuiService")

    clone.Name = playerName
    clone.Text = playerName .. " ?????"
    clone.PlayerValue.Value = playerName

    if UIS.TouchEnabled and not UIS.KeyboardEnabled and not UIS.MouseEnabled
        and not UIS.GamepadEnabled and not GuiService:IsTenFootInterface() then
        clone.Text = playerName .. " ????"
    end

    clone.Parent = UserBoard --a scrollingGui
end)

inputAmount:GetPropertyChangedSignal("Text"):Connect(function()
    if inputAmount.Text == "" then
        inputAmount.Text = 0
    end
    inputAmount.Text = inputAmount.Text:gsub('%D+', '');
    inputAmount.Text = inputAmount.Text:sub(1,7)
    print("Limited Input.")
end)

function keyPressed(input)
    if input.KeyCode == Enum.KeyCode.L then
        if flag then
            flag = false
            frameOutLine.Visible = true
            print("Closed.")
        else
            flag = true
            frameOutLine.Visible = false
            print("Opened.")
        end
    end
end

moneyFrameOpen.MouseButton1Down:Connect(function()
    if flag2 then
        flag2 = false
        moneyFrame.Visible = true
        moneyFrameOpen.Visible = false
        print("Opened.")
    end
end)

moneyFrameClose.MouseButton1Down:Connect(function()
    if flag2 == false then
        flag2 = true
        moneyFrame.Visible = false
        moneyFrameOpen.Visible = true
        print("Closed.")
    end
end)

game:GetService("UserInputService").InputBegan:Connect(keyPressed)
---MoneyEvent
moneyConfirm.MouseButton1Down:Connect(function()
    game.ReplicatedStorage.AdminEvents.AddMoneyEvent:FireServer(moderationframe.InputPlayerName.Text, inputAmount.Text)
    print("Data sent.")
end)
---BanEvents
moderationframe.ServerBanButton.MouseButton1Down:Connect(function()
    game.ReplicatedStorage.AdminEvents.ServerBanEvent:FireServer(moderationframe.InputPlayerName.Text, moderationframe.InputBanKickReason.Text)
    print("Data sent.")
end)
---KickEvents
moderationframe.KickButton.MouseButton1Down:Connect(function()
    game.ReplicatedStorage.AdminEvents.ServerKickEvent:FireServer(moderationframe.InputPlayerName.Text, moderationframe.InputBanKickReason.Text)
    print("Data sent.")
end)
---GlobalBanEvents
moderationframe.GlobalBanButton.MouseButton1Down:Connect(function()
    game.ReplicatedStorage.AdminEvents.GlobalBanEvent:FireServer(moderationframe.InputPlayerName.Text, moderationframe.InputBanKickReason.Text)
    print("Data sent.")
end)
0
Never seen anything like this before nicemorew 15 — 3d

Answer this question