From what I understand you want to get the cframe of the character and then relative from that cframe a left or right position?
If that is the case use
Character.HumanoidRootPart.CFrame.RightVector * 5 -- Right of the Character
Character.HumanoidRootPart.CFrame.LookVector * 5 -- Infront of the Character
Character.HumanoidRootPart.CFrame.RightVector * -5 -- Left of the Character
If by any chance you are trying to fire a bullet or a projectile at the Mouse.Origin but relative to the character
Projectile.Velocity = CFrame.new(Character.HumanoidRootPart.Position,Camera.Origin.Position).LookVector * 100
Also Usually with first person shooters, they use rays
Beautiful thing about rays, is you can cast it from an origin and then set a direction, so it’ll automatically make the ray relative to the character or guns position as long as you set one of those as it’s origin. The direction would just have to be the Mouse’s hit lookvector and how far you want the bullet to go
Mouse.Hit.LookVector * 100
Also as long as the persons always in first person the mouse.Hit.Position, will be the same as the camera’s origin
https://create.roblox.com/docs/reference/engine/classes/Mouse#Hit
huh, ok
so heres my whole script:
RunService.Stepped:Connect(function()
if UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) and not debounce then
debounce = true
local mousePosition = mouse.Hit.Position
local firepoint = mouse.Hit.LookVector
fireEvent:FireServer(mousePosition,firepoint)
wait(0.1)
debounce = false
end
end)
server:
if ammoLeft > 0 and not reloading then
local origin = firepoint + mousePosition.lookvector
local direction = (mousePosition - origin).Unit
particle:Emit(1)
caster:Fire(origin, direction, 1000, castBehavior)
ammoLeft -= 1
wait(0.05)
particle:Clear()
Firepoint needs to be where its shooting from so, if its from a barrel it’d be
Barrel.Position
if it’s from a character it’d be
Character.Head.Position
or
Character.HumanoidRootPart.Position
im using a firstperson arm thing, so the tool is actually dosn’t move at all, so i can’t use the things from the tool
Use the arm as the origin then
hmm i don’t think that works, i feel like i should just use mouse.origin because it goes wherever the camera is pointing at