Hey there, I’m having trouble securing the vehicles in my game:
So, there’s been some advanced exploiters coming into my game manipulating ownership of vehicles in-game as well as house doors. I have a possible fix for house doors, however I’m very new to SetNetworkOwner - as I had just found out about this yesterday.
I’m trying to implement it into our car ownership and it doesn’t appear to be working. Here’s the coding where it functions, along with some extra:
if position ~= nil then
local car
if not police then
car = game.ServerStorage.Cars:FindFirstChild(item):Clone()
else
car = game.ServerStorage.Police:FindFirstChild(item):Clone()
end
car.Name = plr.Name
car.Parent = workspace
car:SetNetworkOwner(plr)
car:MakeJoints()
car:MoveTo(position)
car:WaitForChild("Drive", math.huge).Anchored = true
And here’s the error popping up:
If anybody with experience using SetNetworkOwner could help, it would be GREATLY appreciated!
There is an example of the car - I’m just curious as for if, I connect it to a certain part to prevent this exploit from happening. Does it matter which one?
If the code is giving the driver of the car Network ownership, people who aren’t driving the car shouldn’t be able to alter the car until they begin driving it.
It won’t directly stop people from exploiting it, SetNetworkOwnership is mainly required in cars to make the car driving more smoother as if it’s simulated on the server it could be out of sync, giving the driver network ownership will still allow them to fling it around, but only if they are set as the network owner.
if position ~= nil then
local car
if not police then
car = game.ServerStorage.Cars:FindFirstChild(item):Clone()
else
car = game.ServerStorage.Police:FindFirstChild(item):Clone()
end
car.Name = plr.Name
car.Parent = workspace
car:MakeJoints()
car:MoveTo(position)
car:WaitForChild("Drive", math.huge).Anchored = true
wait(3)
car:WaitForChild("Drive", math.huge).Anchored = false
car.Drive:SetNetworkOwner(plr)
return true
end
I did find that article / tutorial and found it rather confusing - I’m certainly much more of a visual learner. It’s moment like these I wish ROBLOXDev Tutorials made more YouTube tutorials / image tutorials on these subjects.
I’m not getting any errors when spawning the car now however.
yeah, it would be nice to have a dedicated section just for video tutorials. (made by roblox, not by the community) and it takes a bit of time to learn, it took me awhile to figure it out too.
Weird idea that ran through my head while testing the new vehicle is the following:
Is it possible to run a check if they are the NetworkOwner, and if false it would anchor the part which would then anchor the model? Just brainstorming a way to fix these exploits.
they don’t have an event to check for the change, so you’ll have to make a loop that constantly checks for the change yourself. (which sucks IMO)
you could also do other sanity checks in combination with this, like verifying the vehicle (and players) Y position, making sure they aren’t flying etc.
That will only prevent them from flying up and down, they will still be able to fly side to side with no restrictions, but it will make it easier to locate them and deal with them. However, you should simply remove the car if that happens as opposed to kicking/banning. As the cars could still be flung
Also, do you assign the server to be the network owner after the player has left the vehicle? If not, a exploiter could teleport into all the vehicles, gain networkOwnership and fly all of them around without even being in them. You could assign the server to be the network owner after the player has left the car