TouchedEnded is not a valid member of Part "Workspace.Water"

I’m currently working on a drowning system for my little project. I basically have the same system for Touch and Touchended but instead of drowning, it changes tempature. I am getting this error which I found no where else online.

Error: TouchEnded is not a valid member of part “Workspace.Water”

Here is the script:

debounce = true

script.Parent.Touched:Connect(function(hit)
	local character = hit.Parent
	local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
	local humanoid = hit.Parent:FindFirstChildWhichIsA("Humanoid")
	local oxygen = player:WaitForChild("Oxygen").Value
	debounce = true
	
	if humanoid and debounce == true then
		player:WaitForChild("Drown").Value = true
	end
	player.PlayerGui.Oxygen.Oxygen.Text = "Oxygen:"..oxygen
end)

script.Parent.TouchedEnded:Connect(function(hit)
	local character = hit.Parent
	local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
	local humanoid = hit.Parent:FindFirstChildWhichIsA("Humanoid")
	local oxygen = player:WaitForChild("Oxygen").Value
	debounce = false

	if humanoid and debounce == false then
		player:WaitForChild("Drown").Value = false
	end
	player.PlayerGui.Oxygen.Oxygen.Text = "Oxygen:"..oxygen
end)

It’s TouchEnded

https://developer.roblox.com/en-us/api-reference/event/BasePart/TouchEnded

Try this

debounce = true

script.Parent.Touched:Connect(function(hit)
	local character = hit.Parent
	local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
	local humanoid = hit.Parent:FindFirstChildWhichIsA("Humanoid")
	local oxygen = player:WaitForChild("Oxygen").Value
	debounce = true

	if humanoid and debounce == true then
		player:WaitForChild("Drown").Value = true
	end
	player.PlayerGui.Oxygen.Oxygen.Text = "Oxygen:"..oxygen
end)

script.Parent.TouchEnded:Connect(function(hit)
	local character = hit.Parent
	local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
	local humanoid = hit.Parent:FindFirstChildWhichIsA("Humanoid")
	local oxygen = player:WaitForChild("Oxygen").Value
	debounce = false

	if humanoid and debounce == false then
		player:WaitForChild("Drown").Value = false
	end
	player.PlayerGui.Oxygen.Oxygen.Text = "Oxygen:"..oxygen
end)
1 Like

Yeah sorry i’m just a clown with bad eyesight. Didint notice it lol.