have you tried printing Enemy to see what it prints? it could be that you’re getting a value that isn’t nil somehow, it’s a stab in the dark but worth a try. same with printing the Result of the raycast to see if its even detecting a wall/non-human obstacle
Nothing seems to happen.
elseif Enemy == nil then
print(Result)
Fail_SFX.PlaybackSpeed = math.random(9, 11)/10
Fail_SFX:Play()
end
print the result before the result if statement to see if its even detecting anything, if you print it under the if statement assuming that there is a result when there isn’t you’re not going to get any info
When i hit nothing or i hit any part that doesn’t have a humanoid it prints nil
, however when i hit a part of something with a humanoid it prints (for example) something like this : RaycastResult{Left Arm @ 87.4928131, -5.70516539, -17.681324; normal = -1, 0, 0; material = Plastic}
that means your logic for hitting isn’t wrong, it just means that your raycast doesn’t detect anything, the next step is debugging why that happens
I don’t get why it happens, all the code does is check if there is a humanoid in the result and it’s not dead, if there isn’t then play the sound, i put a print statement in the If Enemy
loop and it prints the result.
could you send a video of the code running? it may help debug why it won’t detect a wall but only humanoids
by chance does the part have canquery set to false or no?
No it doesn’t have that set to false.
Bump dshbzjsgaqhzrsazzradfsdgs