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

Question: What is wrong with my remote event script for my team gui?

Asked by 7 years ago
Edited 7 years ago

I'm having some trouble making the remote event to allow my team gui to work in FE mode. This is what I have so far:

local rStorage = game:GetService("ReplicatedStorage")
local team_change = rStorage:WaitForChild("team_change")

function CheckAvailability(Player, TeamName)
    if TeamName == "Visitors" then
        return true
    elseif TeamName == "Enlisted" then
        return Player:IsInGroup(3229439)
    elseif TeamName == "Officer" then
        return Player:IsInGroup(3229439)
    elseif TeamName == "Military Police" then
        return Player:IsInGroup(3229439)
    elseif TeamName == "Air Force" then
        return Player:IsInGroup(3229439)
    end
end

team_change.OnServerEvent:connect(function(Player, Type, TeamName)
    if Player ~= nil then 
        if CheckAvailability(Player, TeamName) then
            Player.TeamColor = game.Teams[TeamName].TeamColor
        end
    end
end)

Script for changing team \/

local rStorage = game:GetService("ReplicatedStorage")
local team_change = rStorage:WaitForChild("team_change")

local MainFrame = script.Parent.MainFrame
local VISITOR = MainFrame:WaitForChild("Visitors")
local ENLISTED = MainFrame:WaitForChild("Enlisted")
local MILITARY POLICE= MainFrame:WaitForChild("Military Police")
local OFFICER = MainFrame:WaitForChild("Officer")
local AIR FORCE = MainFrame:WaitForChild("Air Force")



VISITOR.MouseButton1Click:connect(function()
    team_change:FireServer("Join", "Visitors")
end)


local function ChangeTeamEnlisted()
    team_change:FireServer("Join", "Enlisted")
end

ENLISTED.MouseButton1Click:connect(ChangeTeamEnlisted)

local function ChangeTeamOfficer()
    team_change:FireServer("Join", "Officer")
end

OFFICER.MouseButton1Click:connect(ChangeTeamOfficer)

local function ChangeTeamMP()
    team_change:FireServer("Join", "Military Police")
end

MILITARY.MouseButton1Click:connect(ChangeTeamMP)

local function ChangeTeamAF()
    team_change:FireServer("Join", "Air Force")
end

AIR.MouseButton1Click:Connect(ChangeTeamAF)

This is what is in each text box of the UI, these are localscripts

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function()
    player.TeamColor = BrickColor.new('Steel blue')
    player:LoadCharacter()
end)

0
Looks good to me. Is the top script a regular script in ServerScriptStorage/Workspace, and the bottom a LocalScript in the UI? Goulstem 8144 — 7y
0
Yes Bizarro4812 0 — 7y
0
I posted a new script to see if this has anything to do with it Bizarro4812 0 — 7y
0
Remove the scripts inside the textbuttons Goulstem 8144 — 7y
0
When I removed the scripts and tested it, it won't change the team Bizarro4812 0 — 7y

Answer this question