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

How to stop the console from spamming someone's game?

Asked by 5 years ago
Edited 5 years ago
001bin = script.Parent
002plane = nil
003hold = false
004local debounce = false
005local planedebounce = false
006local stuntdebounce = false
007local controlling = false
008local currentspeed = 0
009local turn = nil
010fly = false
011 
012local missile = false
013local shooting = false
014 
015function fire(gun_Source, player)
View all 283 lines...

So, there's basically this plane we're using and every time you jump out of the pilot seat the game spams the hell out of pilots game with an error message saying that it can't find the Seat part

https://gyazo.com/5fff64b6d17c3ec6c7727e8d564cff08 --What it shows in the console

Anything I can add to the script to make that stop?

0
can u paste shorter code or something greatneil80 2647 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

It's pretty simple, you just need to prevent that error from occurring. To prevent that error just use FindFirstChild()

1if seat:FindFirstChild(game.Players.LocalPlayer.Name) then
2 
3else
4-- if no character in the seat then do nothing
5end

If FindFirstChild() doesn't find the child then it returns nil but if it does find the child then it returns a reference to said child.

1
If it doesn't find the child it returns nil not false. And it returns a reference to the child itself and it doesn't return true. User#24403 69 — 5y
0
Oh, alright. Thank you llMasonIl 12 — 5y
0
@incapaxx yeah, thanks. I had a brain fart. I couldn't remember exactly what values it returned at the time, my bad. ManlikeAzan 90 — 5y
Ad

Answer this question