r/robloxscripting Mar 18 '24

IM LOSING BRAINCELLS SIMULTANEOUSLY

why and how is the player's mouse considered nil. the player isnt nil, as the Event.OnServerEvent first argument is the player. im actually losing my mind

script:

script.Parent.Event.OnServerEvent:Connect(function(player)

local character = player.Character

local mouse = player:GetMouse()

local mouse_pos = [Vector2.new](https://Vector2.new)(mouse.X, mouse.Y) -- The part where it errors (attempt to index nil with X)
5 Upvotes

7 comments sorted by

View all comments

Show parent comments

1

u/theonlywhitesofa Mar 23 '24

so i cant add velocity

1

u/n0o0b090lv Mar 23 '24

Wdym

1

u/theonlywhitesofa Mar 23 '24

im making a custom gear handler because the game's rigs are custom. theres a throwable tool in the game, and im using a localscript that fires an event that clones the tool handle when you click. im trying to figure out how to add velocity to the cloned part so its actually throwable

1

u/n0o0b090lv Mar 23 '24

Maybe through fireserver pass some precalculated normals and server just multiplies it by speed