while wait(1) do local turret = script.Parent local mag = (game.Workspace:FindFirstChild("red").Position - turret.Handle.Position).magnitude if mag < 20 then local ray = Ray.new(turret.Handle.CFrame.p,(game.Workspace:FindFirstChild("red").Position - turret.Handle.CFrame.p).unit * 500) local beam = Instance.new("Part") beam.CanCollide = false beam.Anchored = true local part, position = workspace:FindPartOnRay(ray, game.StarterGui, false, true) -- gotta protect those gui's beam.Parent = game.Workspace beam.Size = Vector3.new(0.2, 0.2, mag) local mag = (game.Workspace:FindFirstChild("red").Position - turret.Handle.Position).magnitude beam.CFrame = CFrame.new(turret.Handle.CFrame.p, position) * CFrame.new(0, 0, -mag / 2) game.Workspace:FindFirstChild("red"):Destroy() game:GetService("Debris"):AddItem(beam,1) end end
have you ever played Blocked Out? if you go here you can check it out, and you'll see all the little beams going towards the parts. i have a script like that above, but i have no clue on doing it for multiple colors. i need to change the brickcolor of the part when its hit, if it's not red. say, it's blue, then it would go to red, then destroy it.do i:
1) make a function for this, with a variable or the thing in the () for the findfirstchild. and then do this for every color
2) the first thing is all i got, anybody else got anything? I don't think the first one will work that well.