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

How can I fix my team select? I've tried tons of solutions and the team selection won't show up.

Asked by 4 years ago

I'm trying to make a team select, similar to those in jailbreak and prison life, but no matter what I try, it doesn't seem to work. I included two localscripts, named Client and Server. Client script: --Player Variables local player=game.Players.LocalPlayer local character

--Character Loading player.CharacterAdded:connect(function(c) character=c end)

--GUI Variable local gui=player:WaitForChild("PlayerGui") local ui=gui:WaitForChild("ui")

--Local assets local assetObject=script:WaitForChild("Assets") local assets={} for a,b in next.assetObject:GetChildren() do assets[b.Name]=b end

--Service shorthands local teams=game.GetService("Teams") local tS=game.GetService("TweenService") local lighting=game.Lighting function tween(t,s,d,p,o) return tS:Create(o,TweenInfo.new(t,Enum.EasingStyle[s],Enum.EasingDirection[d]),p) end

--Replicated storage shorthands local rep=game.ReplicatedStorage local events=rep:WaitForChild("Events") local event=events:WaitForChild("event")

--Team choose function function teamChoose() local chooseUI=assets.teamChoose:Clone() chooseUI.Parent=ui

--Tween blur
tween(1,"Sine","Out",{Size=24},game.Lighting.Blur):Play()

--Mouse down service
local finished
local inmatesDown,policeDown=chooseUI.inmates.MouseButton1Down:connect(function()
    event:FireServer({reason="changeTeam";team=teams.Inmates})
    finished=true
end)
local inmatesDown,policeDown=chooseUI.police.MouseButton1Down:connect(function()
    event:FireServer({reason="changeTeam"; team=teams.Police})
    finished=true
end)

repeat wait() until finished

--Untween blur
tween(0.5,"Sine","Out",{Size=0},game.Lighting.Blur):Play()

--Disconnect events
inmatesDown:disconnect()
policeDown:disconnect()

--Delete UI
chooseUI:Destroy()

end

teamChoose()

Server script:

local rep=game.ReplicatedStorage local events=rep.Events local event=events.event

--Event calling event.OnServerEvent:connect(function(player,data) if data.reason=="changeTeam" then player.Team=data.team end end)

Answer this question