TheZ3P
(TheZ3P)
March 25, 2020, 2:16pm
1
Hello, I have a problem, and that is that my weapon when shooting, the bullet hit effect (which is a part with a decal), is on one side, what I want is that it is arranged based on what I touch, in the direction that goes (If you touch a wall from a different place, stay in the position of the wall and not in the same position)
Here is an example: https://gyazo.com/2f5bc14b510732218e6eb01ff63460f0
Here is the script (not completed , just the bullet clone):
local HitPart = Instance.new("Part")
local Decal = Instance.new("Decal",HitPart)
Decal.Color3 = Color3.fromRGB(91, 93, 105)--Color3.new(91, 93, 105)
Decal.Texture = "rbxassetid://2078626"
Decal.Transparency = 0
Decal.Name = "BulletDecal"
HitPart.Name = "Bullet"
HitPart.Size = Vector3.new(0.5, 0.5, 0.1)--(0.01,0.01,0.01)
HitPart.Transparency = 1
HitPart.Anchored = true
HitPart.CanCollide = false
HitPart.TopSurface = Enum.SurfaceType.SmoothNoOutlines
HitPart.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
HitPart.BackSurface = Enum.SurfaceType.SmoothNoOutlines
HitPart.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
local Particle = HitEffect:Clone()
Particle.Parent = HitPart
local Sound = Instance.new("Sound",HitPart)
Sound.SoundId = "rbxassetid://"..HitSound
Sound.Volume = 1
Sound.MaxDistance = 40
HitPart.Position = EndPos
HitPart.Parent = workspace ---workspace.CurrentCamera
spawn(function() Particle:Emit(2) Sound:Play() end)
game.Debris:AddItem(HitPart,10)
1 Like
helperobc
(helperobc)
March 25, 2020, 2:24pm
2
TheZ3P:
Hello, I have a problem, and that is that my weapon when shooting, the bullet hit effect (which is a part with a decal), is on one side, what I want is that it is arranged based on what I touch, in the direction that goes (If you touch a wall from a different place, stay in the position of the wall and not in the same position)
You could try welding the decal to the character and not anchor it.
However, I would caution you with this effect as too much might result in a [CONTENT DELETED]. I haven’t really been able to figure out what the limit is on gore with Roblox. I Personally say not to bother with it at all.
1 Like
TheZ3P
(TheZ3P)
March 25, 2020, 2:26pm
3
I mean the wall , in new script is welded whit character , but the walls can be welded , the bullet only gets one side and not the wall side.
IUClDS
(Onii_Chan)
March 25, 2020, 2:29pm
4
local HitPart = Instance.new("Part")
local Decal = Instance.new("Decal",HitPart)
Decal.Color3 = Color3.fromRGB(91, 93, 105)--Color3.new(91, 93, 105)
Decal.Texture = "rbxassetid://2078626"
Decal.Transparency = 0
Decal.Name = "BulletDecal"
HitPart.Name = "Bullet"
HitPart.Size = Vector3.new(0.5, 0.5, 0.1)--(0.01,0.01,0.01)
HitPart.Transparency = 1
HitPart.Anchored = true
HitPart.CanCollide = false
HitPart.TopSurface = Enum.SurfaceType.SmoothNoOutlines
HitPart.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
HitPart.BackSurface = Enum.SurfaceType.SmoothNoOutlines
HitPart.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
local Particle = HitEffect:Clone()
Particle.Parent = HitPart
local Sound = Instance.new("Sound",HitPart)
Sound.SoundId = "rbxassetid://"..HitSound
Sound.Volume = 1
Sound.MaxDistance = 40
HitPart.CFrame = CFrame.new(pos, pos + norm)
HitPart.Parent = workspace ---workspace.CurrentCamera
spawn(function() Particle:Emit(2) Sound:Play() end)
game.Debris:AddItem(HitPart,10)
I assume you are using raycasting, so you should do
local hit, pos, norm = workspace:FindPartOnRay(ray)
Them I changed the HitPart.Position to HitPart.CFrame near last line
2 Likes
TheZ3P
(TheZ3P)
March 25, 2020, 2:30pm
5
Yes , i use raycasting and angles , thank you for helping me. Ill try to follow ur idea.
IUClDS
(Onii_Chan)
March 25, 2020, 2:31pm
6
Just copy the code, I’m pretty sure I did this correctly
1 Like