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

Where do I put this clear backpack script within this script?

Asked by 4 years ago

Soooooo, I found a free round Intermission/Round system here's the script

01--Each player is placed slightly farther from the last
02local m_bIncrementLocations = true
03--Teleports all
04local m_bTeleportAll = true -- too lazy to work on this
05 
06local m_iTimerLength = 10 --Round length in seconds
07--Middle time
08local m_iBreakTime = 10 --Intermission
09 
10Model = script.Parent
11ActiveRound = Model.ActiveRound
12RoundTime = Model.RoundTime
13IntTime = Model.IntermissionTimeLeft
14 
15IntTime.Value = m_iBreakTime
View all 75 lines...

Don't Get anxious This script is quite simple and what I wanna do is simpler Soo how do I get that Once every round ends that's this script will run

1script.Parent.MouseButton1Click:Connect(function() --Click detector
2    -- clear tools
3    LocalPlayer.Backpack:ClearAllChildren()
4    local toolInCharacter = LocalPlayer.Character:FindFirstChildWhichIsA("Tool")
5    if toolInCharacter then -- make sure it exists before destroying it
6        toolInCharacter:Destroy()

Its a simple script That I made that clears the player backpack so How do I make so that it clears everybody's inventory system before teleporting to the lobby???

1 answer

Log in to vote
0
Answered by 4 years ago

From what it looks like, you should put that script inside of the function m_fnHandleTimer() function, like this:

01function m_fnHandleTimer()
02        if (ActiveRound.Value and RoundTime.Value > 0) then
03            RoundTime.Value = RoundTime.Value - 1
04        end
05        if (ActiveRound.Value and RoundTime.Value <= 0) then
06            RoundTime.Value = 0
07                Model.IntermissionTimeLeft.Value = m_iBreakTime
08            ActiveRound.Value = false
09            for i, player in ipairs(game.Players:GetChildren()) do
10                max = Model.LobbyBricks:GetChildren()
11                randomlocation = math.random(1,#max)
12                m_fnTeleportTo(max[randomlocation], player, i)
13 
14    --here's where the other script might go
15    --VVVVVVVVVVVVVVVVVVVVVVVVVV
View all 25 lines...
Ad

Answer this question