#Blacklisting a character from a raycast
1 messages · Page 1 of 1 (latest)
should i also make the mousepart thing apart of the module script since i would be requiring that the raycast params be equal to the table in the module script?
ok so im trying and no luck. how would i go about this? i need to get table values from a module script but idk how...
** You are now Level 4! **
"Attempted to call require with invalid arguments"
Why are you requiring the server storage and blacklist for the filter descendants ☠️
I thought you want to exclude char
Btw it's exclude not blacklist
Blacklist is deprecated
U use AI or smth?
never my stupidity is natural
idk
this is literally my first day scripting
im not even familiar with all of the tabs im just moving scripts around to see which one they will work in
Owwww okoo
In Ur first day of scripting I don't recommend you to learn raycasting
You should learn something else like tweenservice
But it's fine
the official roblox tutorial has the module be the same name as the script name so i wasnt sure whether the params take the script name or the module name
at least point me to some resources
the thing is im trying to make it so this raycast doesnt hit the player (the dot represents where the raycast collides)
i just dont want the player to be hit by the raycast so the dot doesnt collide with them, meaning i'll have to blacklist the player
So did you fix it?
no...i just know what i have to do, but i've got to figure out how...
so far, the module scripts dont even seem to be firing when required
and idk why
im ngl i snagged this from a video lol
with the rest of the variables being up here
everything works fine aside from the fact that the raycast stops at the player
i do print "raycast hit" when the raycast hits somethingf
like when i put mouse over player
so i can guarantee the player is getting hit
yeah obs managed to pick it up
Printing raycast hit doesn't guarantee you hit the player, printing raycastresult let you know which object you hit
More specific
raycast result worked, raycast result.instance broke the cursor
What did it print?
this was when there was "print(raycastResult)"
as expected, it is colliding with the character
Lemme see you raycast params again
here
ugh why didnt it load
whats that mean
is it unable to do both? will it only filter one and not the other?
Yeah it can filter a lot but why need to filter mouse?
also then how would i get a character, which would typically be gotten by looping through all descendants of said character. characteradded fails to run in local script
It won't hit the mouse
the video i watched said that it needed to filter the mouse so it doesnt fly towards the camera. let me find it...
Local player = game.players.localplayer
Local char = player.character or player.characteradded:wait()
In this tutorial, I show and explain how to get and use the mouse position to use in your Roblox creations! In this video, I show two methods, one using ray casts and the other using the mouse obj. If you have any questions regarding the series or Roblox Studio in general, join the Discord server: https://discord.gg/xJB2Adu4cr! Make sure to subs...
17 minutes 53 seconds in
ah ok lemme try that
im trying to use this in the local script, so far nothing is happening. should this go into a module script?
srry if im being a dumbass btw😭
what does this mean
cuz like
rn
my only 2 issues are
- getting all of the player base parts into a module script
- requiring a module script so that i can link it to the local script so that everything in the module script is blacklisted
local Player = game.Players.LocalPlayer
local RunService = game:GetService("RunService")
local Char = Player.Character or Player.CharacterAdded:Wait()
local params = RaycastParams.new()
params.FilterDescendantsInstances = {Char}
params.FilterType = Enum.RaycastFilterType.Exclude
RunService.Heartbeat:Connect(function()
local Mouse = Player:GetMouse()
local UnitRay = Mouse.UnitRay
local origin = UnitRay.Origin
local direction = UnitRay.Direction * 10000
local result = workspace:Raycast(origin, direction, params)
if result then
print(result.Instance)
else
print("No hit")
end
end)
enter this into ur local script
make a new one
that worked, thank you
** You are now Level 10! **
wait gimme a sec to study this real quick
yeah alright i understand the script now
** You are now Level 5! **
tysm