如何越狱-团队选择-Roblox



欢迎来到“如何制作游戏”系列,本季我们重点关注越狱。在本集中,我们将为您首次加入游戏的团队选择系统工作。如果该视频对您有帮助,请不要忘记喜欢该视频并订阅以获得该系列的未来剧集。非常感谢您的收看!


DISCORD➤https://discord.gg/5zABugw

订阅➤http://www.youtube.com/subscription_center?add_user=ChewbaccaUverses

TWITTER➤https://twitter.com/Spooksletsky。

50 comments
  1. Hi can you pls check if there is somthing wrong with my 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")

    –Load 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

    –ReplicatedStorage 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},lighting.Blur):Play()

    –Mouse Down Service

    local finished

    local prisonerDown,policeDown=chooseUI.police.MouseButton1Down:connect(function()

    event:FireServer({reason="changeTeam"; team=teams.Prisoner})

    finished=true

    end).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},lighting.Blur):Play()

    –Disconnect events

    prisonerDown:disconnect ()

    policeDown:disconnect()

    –Delete UI

    chooseUI:Destroy()

    end

    teamChoose()

  2. can u put the hole script in the comments cos i messed up and i dont know were. so if u put both scripts in the comments we could copy it? if thats ok?

  3. Spooks, may you please look over this and see if I made any mistakes? (If you see that there is different UI Names thats because I changed them)

    Script I did:

    — player variables
    local player = game.Players.LocalPlayer
    local character

    — char loading
    player.CharacterAdded:Connect(function(c)
    character = c
    end)

    — gui variables
    local gui = player:WaitForChild("PlayerGui")
    local teamGui = gui:WaitForChild("TeamGui")

    — load 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

    — rs short hands
    local RS = game.ReplicatedStorage
    local TEvents = RS:WaitForChild("TeamEvents")
    local changeTeam = TEvents:WaitForChild("ChangeTeam")

    function tween(t,s,d,p,o)
    return TS:Create(o,TweenInfo.new(t,Enum.EasingStyle[s],Enum.EasingDirection[d],p))
    end

    — Team chosen

    function TeamFrame()
    local chooseUI = assets.TeamFrame:Clone()
    chooseUI.Parent = teamGui

    — tween blur
    tween(1,"Sine","Out",{Size = 24},lighting.Blur):Play()

    — mouse down service
    local finished
    local prisonerDown,policeDown = chooseUI.PrisonerBtn.MouseButton1Down:Connect(function()
    changeTeam:FireServer({reason = "changeTeam";team = teams.Prisoner})
    finished = true
    end),chooseUI.PoliceBtn.MouseButton1Down:Connect(function()
    changeTeam:FireServer({reason = "changeTeam"; team = teams.Police})
    finished = true
    end)
    repeat wait() until finished

    — untween blur
    tween(0.5,"Sine","Out",{Size = 0},lighting.Blur):Play()

    — disconnect events
    prisonerDown:disconnect()
    policeDown:disconnect()

    chooseUI:Destroy()
    end

    TeamFrame()

  4. Client:

    –Player Variables

    local player=game.PLayer.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")

    –Load 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.EnumStyle[s].Enum.EasingDirection[d]).p)

    end

    –ReplicatedStorage 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}.lighting.Blur):Play()

    –Mouse down service

    local finished

    local prisonerDown.policeDown=chooseUI.prisoner.MouseButton1Down:connect(function()

    event:FireServer({reason="cahngeTeam":team=teams.Prisoner})

    finished=true

    end).chooseUI.police.MouseButton1Down:connect(function()

    event:FireServer({reason="cahngeTeam":team=teams.Police})

    finished=true

    end)

    repeat wait()until finished

    –Untween blur

    tween(0.5."Sine"."Out".{Size=0}.lighting.Blur):Play()

    –Disconect events

    prisonerDown:disconect()

    policeDOwn:disconect()

    –Delete UI

    chooseUI:Destroy()

    end

    teamChoose()

    Server:
    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)

    Please Correction My Work

  5. Hey SpooksHD u were amazing builder to me and u make good scripts and all kind of stuff and i really like ur channel i liked and subscirbed!

  6. At service shorthands, i see an error in function tween(t,s,d,p,o). I dunno why but i literally spent 30 minutes on doing this and failed

Comments are closed.