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

[ Solved ] Taking Oxygen On Contact To Water?

Asked by
M39a9am3R 3210 Moderation Voter Community Moderator
10 years ago

The script I had made, I thought would take oxygen on contact with Roblox water. Except it does not, turns out if you just walk in, it will not recognized the humanoid is swimming until they jump. I was curious if there was a more effective way to detect if a player is swimming in water than what I have for code. Any help will be appreciated.

--Code Removed, problem solved.

Thank you.


Alright, I did some experimenting. I used the .Swimming event and that seems to pick up that a person is in the water and is swimming. It now picks up that a player made contact with the water, probably should have experimented on that event rather than just relying on the data I had the script print in the output to begin with. The original code was using StateChanged which would not pick up a person swimming immediately.

1
Maybe it's line 31, does 'oxygen' exist as a variable before this code snippet? Tkdriverx 514 — 10y
0
Yes... I am making oxygen optional for a possible public release. I just forgot to put most of the code into the if then statement. I even stated my problem above the code, it is detecting that I am swimming after I jump when I am submerged in water. I want the script to detect that I am in the water and to take oxygen. M39a9am3R 3210 — 10y
0
hey i want an oxygen system put ur code back\ User#24403 69 — 5y

1 answer

Log in to vote
-1
Answered by 10 years ago

Line 31's oxygen is lowercase and it's not defined anywhere.

The uppercase "Oxygen" is an object, I see that now.

0
"Maybe it's line 31, does 'oxygen' exist as a variable before this code snippet?" ... "Yes... I am making oxygen optional for a possible public release. I just forgot to put most of the code into the if then statement. I even stated my problem above the code, it is detecting that I am swimming after I jump when I am submerged in water. I want the script to detect that I am in the water and to take M39a9am3R 3210 — 10y
0
My bad, I'm definitely not an expert scripter. dirty_catheter 7 — 10y
Ad

Answer this question