Are server scripts inside guns hackable?

I have a gun that has a client script and a server script inside the gun.

The gun goes in the player character when equipped.

Since the gun is inside the character, can the server script be hacked by the client?

2 Likes

Depends on the code care to share?
(and it is prob is assuming its a free model)

The client could delete the server script and it would mess up the gun, but that’s not really hacking the gun. Depending on the server’s dependency on the client, the client could manipulate the server how they want.

Not a free model but based on a video.

I have modified it heavily since the video, but the core functions are the same.

It used FastCast and PartCache.

This is the video that I started with a long time ago.

This video is long but here:

Simple explanation: Hackers can only hack through Remote Events/Remote Functions

Learn more about Remote Events/Remote Functions:

Learn more about How Hackers Hack:

The server script does all the work.

The client script just triggers the remote event and sends the mouse position.

Then the best that the client could do is send the server a false position that the client wants to fire at and the server will fire there. Other than that, the client cannot manipulate the gun.

Thank you.

I feel like I am asking a question I know the answer to but at the same time I have never read someone saying specifically that server scripts cannot be hacked no matter what. Even when the client has a copy during gameplay.

1 Like

anything on the server is not accesable by the client
only if you code it so
like a fire gun remote

ServerScripts cannot be hacked, but the client can provide false information. If the server script is under a place that the client has ownership of (like their character), they can, however, delete it.

2 Likes

Thank you.

I have read all that stuff several times and came across the same video.

I guess it just confuses me that the client has the server script on their machine but can’t hack it. Or, do they have a copy on their machine? I can’t find a clear answer.

Use logic checks (pretty sure that’s the name)

For example:

If a player isn’t allowed to talk to an NPC from at least 10 studs away (can only talk within 10 studs of the NPC), then punish the player.

Code example:

local NPC = workspace.NPC
local character = game.Players.LocalPlayer.Character
local remoteEvent = game.ReplicatedStorage.TalkToNPC -- HACKABLE FROM CLIENT

remoteEvent.OnServerEvent:Connect(function()
    if (NPC.HumanoidRootPart.Position - character.HumanoidRootPart.Position).magnitude > 10 then -- distance
        -- Punish player
    end
end)

I did build in checks to make sure the things that matter are valid.

They can hack the client script all they want. It won’t do any good. They can send any info they want to the remote event. It won’t do any harm.

The problem in my head is that the server script is part of the gun model so it is automatically put inside the character when the gun is equipped.

Do you know if they actually get a copy of the script since it is inside the gun?

If so, does it do them any good to have it?

if its not a local script or on the client
the code is completely UNACCESSABLE

1 Like

Yep, the hackers can’t do anything with it.

Unlesssssss there is a remote event connected to another Server Script that disables the gun script… which is probably not the case lol

Awesome.

Thank you for helping me feel better.

I have put a ton of work into the guns and would be sad if they just go hacked anyway.

Thanks to everybody for pitching in!

1 Like

Mind showing your gun? Sounds cool if it uses Fast Cast.

Um.

Not sure how to do that really. It’s a mess of files right now. I need to put it back like it was – with the server script inside the actual gun.

I had moved the server script to server script service, but then realized it won’t work because the remote event causes everybody with the gun equipped to fire the gun at the same time! :crazy_face:

Rebuild time. But, at least it won’t take that long.

That video I posted above was really helpful. The one by BRicey. It’s only missing one key thing that I found a solution to on the dev forum:
Need help with FastCast Redux bullets freezing in air - #9 by pictureu
pictureu (dthecoolest) Jan1

1 Like