#making a 3rd person gun

1 messages · Page 1 of 1 (latest)

vague path
#

let me know what u think cause there's another problem in that order

unkempt berry
#

If you have semi automatic weapons, you'll have to fire a remote event everytime the player shoots but also have a cooldown on the server to prevent exploiters from spam-firing the remote event

#

For automatic weapons, just like you suggested

#

You could also use an attribute/BooleanValue on the server and switch it, it will replicate to all clients and new clients automatically, if true, fire

vague path
unkempt berry
#

You have no other way of sending the information

#

Also, all you're doing is firing the remote event without data

#

it's not bad

vague path
#

i forgot to mention this VERY important something:
the player's camera ray is assigned using the player's current camera ==> this right here is the cause of this whole problem

#

only if i could access a player's current camera without having to do it locally

vague path
#

I change my question

#

is there any way i can do somethin like this

⚠️⚠️ THIS LOCAL SCRIPT IS FROM SUPHI ⚠️⚠️

local function calculate_ray()
    local cam = workspace.CurrentCamera
    -- calculate ray with the suphi's cam
end

⚠️⚠️ THIS LOCAL SCRIPT IS FROM CAPSORI ⚠️⚠️

local function calculate_ray()
    local cam = workspace.CurrentCamera
    -- calculate ray with the capsori's cam
end

⚠️⚠️ THIS LOCAL SCRIPT FROM CAPSORI WANTS TO GET SUPHI S CAMERA⚠️⚠️

local Suphi = game.Players.suphi
local suphi_cam = Suphi.CurrentCamera ???

local function calculate_ray()
    -- calculate ray from capsori's client side with suphi's camera
end

dapper ingot
#

This is very easy in my eyes

#

you need to

#

detect mouse click/hold

#

then send the mouse direction

#

I'll explain later how to do it because I have piano class

#

If I remember correctly, you have to use this function to find out the mouse direction

wintry mantle
#

to detect if they holding click u could simplyuse a variable named "shooting" and repeat wait until that variable is false

vague path
# dapper ingot then send the mouse direction

the problem is in sending the mouse direction
from one side, i cant be firing multiple events sending the direction to the server at once (that will cause performance problems)
and from another side i dont have any other way to access the ViewportPointToRay of another player's camera

vernal violet
#

you only need to send essential data to the server, such as where the raycast starts, and the direction.

#

Firing this often doesn't cause performance problems. Performance issues only come from sending a lot data too often

#

sending two vector3s isn't anywhere close to the network send/receive limit. You could fire this 100 times per second and the remotes could handle it