Hey, so basically I have a map where players can be arrested when they enter a certain area. When they touch a part, it makes them arrestable or unarrestable. Currently when they touch the part, it is handled locally and fires to the server to make them arrestable or unarrestable. Is this a good idea? I figure if they are able to disable the local script from firing, they would be able to just delete the part from the workspace with btools, right?
Also, the game isn’t going to be extremely popular, so I plan on being able to manage having moderators in a majority of the servers most of the time
The Client will only replicate to one Player, and not the entire Server, RemoteEvents would just send that data to the Server, though it may be better to handle it on the Server rather than the Client as you can practically do the same thing there.
Only on the Client, what they do themselves on the Client will only effect them. unless they have access the Server
I don’t understand why the part touching has to be handled on the client? Seems pretty unnecessary and a pretty easy fix, you should try to prevent exploiting when you can even if you’re going to have moderators, you don’t want to give them a headache.
True, but what prevents them from just deleting the part that makes them arrestable? I suppose I could randomly check their position, and if they are in an arrestable area and are’t arrestable, then I could assume they are exploiting.
In my opinion, the region of arresting would be best checked using the Vector3 coordinates instead. They could check if they are within a range and loop through ranges for it.
But if they delete it on the client, then they wont touch the part because it’s not on the client. If all of it was controlled on the server, then could they delete the part locally and not be registered because the part is gone?
Thats because they make the Server look through itself and Apply Connections, it would be a lot worse if you had a part from every KillBrick with a script, which would slow down the game
local ArrestableFolder = workspace:WaitForChild("ArrestableParts")
local UnArrestableFolder = workspace:WaitForChild("ArrestableParts")
local Prisoners = game:GetService("Teams")["Prisoners"]
for i,v in pairs(ArrestableFolder:GetChildren()) do
v.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Player.Team == Prisoners then
if Player:WaitForChild("Arrestable").Value == false then
Player:WaitForChild("Arrestable").Value = true
end
end
end
end)
end
for i,v in pairs(UnArrestableFolder:GetChildren()) do
v.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Player.Team == Prisoners then
if Player:WaitForChild("Arrestable").Value == true then
Player:WaitForChild("Arrestable").Value = false
end
end
end
end)
end
Indeed, that is why I suggested checking it with Vector3 coordinates instead. Have a start point and an end point forming a rectangle and loop through all of your rectangles and check if the player is within them.
True, I have a police team, a prisoners team and a criminals team, (and neutral when they join the server) but whenever the player joins the server they are given the arrestable value anyways so it doesn’t have to be removed and added back whenever they switch teams, if they sounds better?
I am working within a building, so it’s mainly rooms and spaces that they are in, and every few studs matter, so if I run a loop checking their position every 2 seconds, they might be able to run into a room within those 2 seconds and do something. Not sure if it is easier just having parts control it because they can be more exact, and I heard loops can become laggy on the server so I’m trying to cut down as much
local params = OverlapParams.new()
params.FilterDescendantsInstances = {}--put every folder in workspace in here so it only focuses on characters
for i, v in pairs(workspace:GetPartsInPart(yourHitBox,params)) do
--all characters in the part will be in here even if they tinkered with the part
end