Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Raycast isn't working properly, I assume i'm using Raycasting incorrectly?

Asked by 3 years ago
Edited 3 years ago

I'm attempting to make a rubble effect using raycasting. It does not work and i'm not sure if they raycast even happens. EDIT: The raycast does happen, but it doesnt hit anything. Which it should because it summons in a part when i test it.


local tweenservice = game:GetService("TweenService") local rayParrams = RaycastParams.new() rayParrams.FilterDescendantsInstances = {nil} rayParrams.FilterType = Enum.RaycastFilterType.Blacklist for i, v in pairs(script.Parent.Rubble:GetChildren()) do local ray = workspace:Raycast(v.CFrame.p, v.CFrame.UpVector, rayParrams) if ray then v.Orientation = Vector3.new(math.random(-180,180),math.random(-180,180),math.random(-180,180)) v.Material = ray.Instance.Material v.BrickColor = ray.Instance.BrickColor local tween = tweenservice:Create(v, TweenInfo.new(1,Enum.EasingStyle.Linear), {CFrame = v.CFrame + CFrame.new(0,v.Size,0)}):Play() wait(2) local tween = tweenservice:Create(v, TweenInfo.new(1,Enum.EasingStyle.Linear), {CFrame = v.CFrame - CFrame.new(0,v.Size,0)}):Play() end end wait(5) script.Parent:Destroy()

Answer this question