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

How should I go on about putting sanity checks on gun?

Asked by 4 years ago
Edited 4 years ago

Someone reccomended me in the dev forum that I check if it hit something in the client so I made the ray in the client

and this is my local script


local Remote = game.ReplicatedStorage.RemoteEvent local Tool = script.Parent local Handle = Tool.Handle local Player = game:GetService("Players").LocalPlayer Tool.Equipped:Connect(function(Mouse) Mouse.Button1Down:Connect(function() local ray = Ray.new(Handle.CFrame.Position,(Mouse.Hit.Position - Handle.CFrame.Position).Unit*800) local part, position = workspace:FindPartOnRay(ray, Player.Character, false, true) local Humanoid = part.Parent:FindFirstChild("Humanoid") if Humanoid then --If Humanoid is found Remote:FireServer() end end) end)

But What I dont understand is how would I damage the person safely so that no hacker can just fire a remote to exploit

my server script

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player)

What checks should be put here?

end)

1 answer

Log in to vote
0
Answered by
IDKBlox 349 Moderation Voter
4 years ago

Honestly you can never be 100% secure from 'Hackers'. Especially with Server/Client lag..

But something you could do is: you could send their origin and their 'end point' and do some checks with it.

see if their origin is within like 5 studs of where the ray is being created from. or see if the origin to the endpoint is within so many studs.

There are honestly a lot of 'sanity checks' you could do...

But you have to be careful with it. Because sometimes players with bad internet may seem like their 'exploiting' when their just lagging.

Ad

Answer this question