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

Half script plays, the other half doesn't for one part of the script but it does for the other?

Asked by 7 years ago
Edited 7 years ago

Ok, so The Top part of the Script where it says "Away" the gui shows that, but it doesn't complete the whole script. It just says that and the script breaks. Under that, the "Home" Part if that is true then it plays the whole script, I don't know how to get the "Away" part to complete the entire script like "Home" part does.

d=true
plr=game.Players.LocalPlayer
char=plr.CharacterAdded:wait()
while wait() do
    wait(math.random(0,10)/10)  
    if d and char:WaitForChild("Humanoid").Jump and workspace:findFirstChild(plr.Court.Value)._Values.playing.Value==true and char:FindFirstChild("_Ball1") then
        d=false
        wait(1)
        if char:FindFirstChild("_Ball1") then
            workspace:findFirstChild(plr.Court.Value)._Shotclock.Timer.whistle:Play()
            if workspace:findFirstChild(plr.Court.Value)._Values.team.Value=="Away" then --The Gui shows this and it doesnt complete the entire script
                workspace:findFirstChild(plr.Court.Value)._Values.foul.Value=
"Traveling"
                wait(1.5)
                workspace:findFirstChild(plr.Court.Value)._Values.foul.Value=""
                end
            else
                if workspace:findFirstChild(plr.Court.Value)._Values.team.Value=="Home" then --The Gui shows this and it completes the entire script
                workspace:findFirstChild(plr.Court.Value)._Values.foul.Value=
"Traveling"
                wait(1.5)
                workspace:findFirstChild(plr.Court.Value)._Values.foul.Value=""
                end
                workspace:findFirstChild(plr.Court.Value)._Values.removal.Value=true
            wait(0.5)
            local c=game.Players:children()
            for i=1, #c do
                if c[i]._Team.Value=="Away" then --away team
                    c[i].Character.Torso.CFrame = CFrame.new(workspace:findFirstChild(plr.Court.Value)._Positions.awaytp.Position) --Position
                elseif c[i]._Team.Value=="Home" then --home team
                    c[i].Character.Torso.CFrame = CFrame.new(workspace:findFirstChild(plr.Court.Value)._Positions.hometp.Position) --Position
                end
            end
            if workspace:findFirstChild(plr.Court.Value)._Values.team.Value=="Away" then
                local ball=game.Lighting._Ball1:Clone()
                wait(0.5)
                ball.Parent=workspace
                ball.Handle.Position=workspace:findFirstChild(plr.Court.Value)._Positions.homeball.Position
            elseif workspace:findFirstChild(plr.Court.Value)._Values.team.Value=="Home" then
                local ball=game.Lighting._Ball1:Clone()
                wait(0.5)
                ball.Parent=workspace
                ball.Handle.Position=workspace:findFirstChild(plr.Court.Value)._Positions.awayball.Position
            end
        end
        d=true
    end
end

I Figured out the problem is in this:

else
                if workspace:findFirstChild(plr.Court.Value)._Values.team.Value=="Home" then
                workspace:findFirstChild(plr.Court.Value)._Values.foul.Value=
"Traveling"
                wait(1.5)
                workspace:findFirstChild(plr.Court.Value)._Values.foul.Value=
""
                end
            wait(0.5)
0
Error messages would be helpful chess123mate 5873 — 7y

Answer this question