[Solved] Hitbox Raycast Problem?
Asked by
4 years ago Edited 4 years ago
I'm making a fighting game (another jojo game) and I'm having problems with making a hitbox using raycast.
It's saying that the variable "CastResults" == nil
Extra Information:
The variable "Stand" is a model, containing R6 Rigparts, it's primarypart is the HumanoidRootPart
My failed output:
1 | ServerScriptService.StandServerHandler: 233 : attempt to index nil with 'Instance' |
My raycast code:
01 | local RaycastParameters = RaycastParams.new() |
02 | RaycastParameters.FilterType = Enum.RaycastFilterType.Blacklist |
03 | RaycastParameters.FilterDescendantsInstances = { Stand, Character } |
04 | RaycastParameters.IgnoreWater = true |
06 | local CastResults = Workspace:Raycast(Stand.PrimaryPart.CFrame.Position, Stand.PrimaryPart.CFrame.LookVector * 500 , RaycastParameters) |
08 | local Hit = CastResults.Instance |
09 | local HitPosition = CastResults.Position |
10 | local Surface = CastResults.Normal |
11 | local Material = CastResults.Material.Name |