of     1   

o0Volvic0o
#220977392Monday, July 10, 2017 4:30 PM GMT

Script local SafeZB = script.Settings.SafeZone -- SafeZone is a BoolValue safeZ.Touched:Connect(function(hit) -- Touched function local player=game.Players:GetPlayerFromCharacter(hit.Parent) -- Getting Player if player and player==game.Players.LocalPlayer then -- Making sure player is local SafeZB.Value = true -- Changing the Value to true end end) if SafeZB.Value == true then -- Dunno while SafeZB.Value == true do -- Dunno if player and player==game.Players.LocalPlayer then -- Player is local PatrolAnim() -- Cfram Anim PatrolMode=true end end end I'm trying to make it when SafeZB value is true it will run PatrolAnim() PatrolMode=true
o0Volvic0o
#220993890Monday, July 10, 2017 7:44 PM GMT

b1
o0Volvic0o
#220997245Monday, July 10, 2017 8:25 PM GMT

bump2.0
o0Volvic0o
#220998933Monday, July 10, 2017 8:45 PM GMT

bump0
KnightmareXD
#220999447Monday, July 10, 2017 8:51 PM GMT

A couple of things. "player" would be 'local' to the function you defined, hence 'local'. The would not be able to use the "player" variable in the loop since it is outside of the function. Also, you defined your loop inside of the if statement. What this does will initially check for the value (which is probably false at this point) at the start of the script. Since it is probably false, the while loop will never run. You can try this, though it will probably be a little 'hacky', post results. local SafeZB = script.Settings.SafeZone -- SafeZone is a BoolValue safeZ.Touched:Connect(function(hit) -- Touched function local player=game.Players:GetPlayerFromCharacter(hit.Parent) -- Getting Player if player then SafeZB.Value = true -- Changing the Value to true while SafeZB.Value and Wait() do if player.Character then PatrolAnim() PatrolMode=true end end end end)
KnightmareXD
#220999701Monday, July 10, 2017 8:54 PM GMT

To clarify since my English is terrible apparently: You set "player" variable's scope to the Touched function. You cannot use this outside of it. Also, you defined your loop inside of the if statement. The loop will not run at all unless the condition to the if statement is true when it is first checked.
o0Volvic0o
#221000664Monday, July 10, 2017 9:06 PM GMT

Yeah works but it keeps looping.. safeS.Touched:Connect(function(hit) -- Touched function local player=game.Players:GetPlayerFromCharacter(hit.Parent) -- Getting Player if player then SafeZB.Value = false -- Changing the Value to true while SafeZB.Value and wait() do if player.Character then IdleAnim() PatrolMode = false end end end end) I used that so when player hits a sec part it will run it but it don't work because I dunnno... prob looping the first one ################ ################# yeah
o0Volvic0o
#221000776Monday, July 10, 2017 9:08 PM GMT

Yeah works but it keeps looping.. safeS.Touched:Connect(function(hit) -- Touched function local player=game.Players:GetPlayerFromCharacter(hit.Parent) -- Getting Player if player then SafeZB.Value = false -- Changing the Value to true while SafeZB.Value and wait() do if player.Character then IdleAnim() PatrolMode = false end end end end) I used that so when player hits a sec part it will run it but it don't work because I dunnno... probably looping
KnightmareXD
#221001230Monday, July 10, 2017 9:14 PM GMT

Yes it should keep looping until SafeZB.Value is false. Sorry, I wasn't exactly clear on what you wanted. What is continuously happening, and when do you want it to stop looping?
o0Volvic0o
#221002388Monday, July 10, 2017 9:28 PM GMT

Thanks btw, Yeah so when player walks into a part Value will go to true and run the anim When player walks into the sec part it will set the value to false and run the anim FIRST PART (SafeZone Part) local safeZ=workspace.NOSOT SEC PART (Out of SafeZone Part) local safeS=workspace.SOT
o0Volvic0o
#221002458Monday, July 10, 2017 9:29 PM GMT

If anything I can just add you and invite you to a team crate>?
KnightmareXD
#221002678Monday, July 10, 2017 9:31 PM GMT

Do you have the code of the second part? And did you want the animation in the first part to continue running until it is false?
o0Volvic0o
#221003564Monday, July 10, 2017 9:41 PM GMT

local safeZ=workspace.NOSOT local safeS=workspace.SOT local SafeZB = script.Settings.SafeZone ------(SAFEZONE)----- safeZ.Touched:Connect(function(hit) -- Touched function local player=game.Players:GetPlayerFromCharacter(hit.Parent) -- Getting Player if player then SafeZB.Value = true -- Changing the Value to true while SafeZB.Value and Wait() do if player.Character then PatrolAnim() PatrolMode=true end end end end) ------(OUT OF SAFEZONE)----- safeS.Touched:Connect(function(hit) -- Touched function local player=game.Players:GetPlayerFromCharacter(hit.Parent) -- Getting Player if player then SafeZB.Value = true -- Changing the Value to true while SafeZB.Value and Wait() do if player.Character then IdleAnim() PatrolMode = false end end end end)
o0Volvic0o
#221003684Monday, July 10, 2017 9:42 PM GMT

So when player walks into safezone run Anim 1 then when player walks into part2 runs anim2
o0Volvic0o
#221003750Monday, July 10, 2017 9:43 PM GMT

------(OUT OF SAFEZONE)----- safeS.Touched:Connect(function(hit) -- Touched function local player=game.Players:GetPlayerFromCharacter(hit.Parent) -- Getting Player if player then SafeZB.Value = false -- Changing the Value to true while SafeZB.Value and Wait() do if player.Character then IdleAnim() PatrolMode = false end end end end)
o0Volvic0o
#221005396Monday, July 10, 2017 10:02 PM GMT

b1

    of     1