Hello, i am a fellow scripter and i’m wondering how to make a blood system and make a part with a trail and when the part is touched it makes a splat or spill, I’ve tried using raycasting but i still havent gotten the hang of it!
But what i did is i had to do the opposite and make a splat and then make the part with the trail follow it but it doesnt really look good.
This is a video of me trying it robloxapp-20200823-1819421.wmv (2.5 MB) sorry for the bad quality seems like roblox’s recording button isnt that well.
If you wan’t to check out game yourself go to RVVZ's Place fix - Roblox and, by the way my game is inspired by RVVZ!
I am learning about raycasting, and need some help.
Can we see your code? You have the right idea with the raycasting, but the video shows that the blood splat is well behind the player. You should just be raycasting downwards to get the player’s current position.
Something like this:
local ray = Ray.new(Player.Character.HumanoidRootPart.Position, Vector3.new(0, -10, 0) -- longer rays are more expensive. There shouldn't be many cases where the player is more than 10 studs off the ground. If it is a problem, just use a bigger number
local hit, pos = workspace:FindPartOnRay(ray, player.Character) -- player.Character is ignored in raycast
-- place blood splat at pos
Also, I’m not entirely sure if having blood splatters like this is allowed by roblox ToS. You may want to make sure it’s allowed and not too gruesome for roblox.
Sure thing! and the blood splatters are for testing and i may minus the size and majority of times it spits out ok this is the code, i’ve used a event to fire it BloodServer.lua (4.4 KB)
This is the line for raycasting I took from your code.
local dray = Ray.new(p.CFrame.p + Vector3.new(0, -1, 0), ((p.CFrame + Vector3.new(0, -20, 0)).p - p.CFrame.p).unit*((p.CFrame + Vector3.new(0, -20, 0)).p - p.CFrame.p).magnitude)
You’re way over complicating this. Rays take an origin and direction argument. Since you want to raycast downwards, you don’t need to do fancy math with origins and destinations. Just a simple negative Y vector
Vector3.new(0, -20, 0).
Well, i am the person who edits scripts and learns from them, so i took that code from another script and refined it but it wasnt perfect, but ill try this code and tell you if it works!
Wow thanks! it worked! and i learned something aswell thanks!
Could you possibly make the place open source? I’ve been wanting to do something like this for a while.
Well, im not finished with the blood script yet, but once its finished i may make a open sourced version. Plus ROBLOX’s Terms Of Service is a little suspicious on blood. But i may make it open sourced with settings and rules on it. Thanks for the suggestion!
Thank you for the response!!!
Just looking at this post. Pretty cool! Could you made it open source?