-
What do you want to achieve? A raycast that gets the position of where the raycast hit.
-
What is the issue? The raycasting works fine on everything except for the baseplate, the impact particle doesnt even spawn.
-
What solutions have you tried so far? I’ve looked over the API and watched a few videos. I would use the depreciated version which Im more familiar with but I want to learn the new way.
here’s the script that handles the raycasting
connection = Blast.Touched:Connect(function(touched)
connection:Disconnect()
local rayOrigin = Blast.Position
local rayDirection = Position
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {Character:GetDescendants()}
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local raycastResult = workspace:Raycast(rayOrigin, rayDirection, raycastParams)
task.spawn(function()
if raycastResult then
local HitPosition = raycastResult.Position
local Impact = Effects["Psionic Blast Impact"]:Clone()
Impact.Parent = workspace.DebrisFolder
Impact.Position = HitPosition
for i, v in pairs(Impact:GetDescendants()) do
if v:IsA("ParticleEmitter") then
v.Enabled = true
end
if v:IsA("PointLight") then
TweenService:Create(v, TweenInfo.new(0.6), {Brightness = 2}):Play()
end
end
task.wait(0.4)
for i, v in pairs(Impact:GetDescendants()) do
if v:IsA("ParticleEmitter") then
v.Enabled = false
end
if v:IsA("PointLight") then
TweenService:Create(v, TweenInfo.new(0.6), {Brightness = 0}):Play()
end
end
wait(10)
Impact:Destroy()
end
end)
all help is greatly appreciated