Hello there 
There are some things to be addressed in your code. Let’s start with the “Connect” variable.
It’s not necessary to use the disconnect event as long as removing the instance is handled through the :Remove()
method or by ROBLOX internally (when a character respawns). Therefore, you can remove the entire if-statement that checks if the variable is set.
The “IsFalt”-variable seems to be a global variable (which isn’t defined properly). You set it to true
once and never touch it again.
Let’s declare the variable at the top of your program along with the rest:
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local Humanoid = Character:WaitForChild("Humanoid")
local IsFalt = false -- added the variable for clarity
Now that this is taken care of, we can move on to the main problem.
As mentioned before, you’re setting the “IsFalt” variable only once in your entire program, specifically to “true.” From what I see, you check the variable to be “false” (... and not IsFallen
), which only happens once and then never again.
A solution would be to set the variable back to false
somewhere in your code.
Without knowing what you’re trying to achieve, it’s difficult to pinpoint exactly where to reset the variable. However, here’s a possible version that might solve your problem.
-- It's StarterPlayerScript
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local Humanoid = Character:WaitForChild("Humanoid")
local IsFalt = false -- added the variable for clarity
-- local Connect -- this can be removed as ROBLOX takes care of the garbage collection
Player.CharacterAdded:Connect(function(NewChar)
-- if Connect then -- this can be removed as ROBLOX takes care of the garbage collection
-- Connect:Disconnect()
-- end
OutSideWater()
Character = NewChar
HumanoidRootPart = NewChar:WaitForChild("HumanoidRootPart")
HumanoidRootPart.Touched:Connect(function(hit)
if hit.Name == "Water" and not IsFalt then
IsFalt = true
InSideWater()
Humanoid:ChangeState("Physics")
task.wait(3)
Event_LoadCharacter:FireServer()
elseif hit.Name ~= "Water" and IsFalt then
IsFalt = false
end
end)
end)
function InSideWater()
Sounds.Ambience:Play()
Sounds.WaterLeave:Play()
for i= 0, 15 do
WaterBlur.Size = i
WaterColor.TintColor = Color3.new(1 - .038 * i, 1 - .027 * i, 1 - .014 * i)
task.wait()
end
end
function OutSideWater()
Sounds.Ambience:Stop()
for i = 15, 0, 1 do
WaterBlur.Size = i
WaterColor.TintColor = Color3.new(1 - .038 * i, 1 - .027 * i, 1 - .014 * i)
task.wait()
end
end
I really hope this helped you out.
If you have more questions feel free to ask them.