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

This touched function isn't working im trying to make a power do dmg?

Asked by 3 years ago
game.ReplicatedStorage.PizzaPower1Remote.OnServerEvent:Connect(function(player)
    local beam = game.ReplicatedStorage.PowerParts.Beam:Clone()
    local BeamRing = game.ReplicatedStorage.PowerParts.BeamRing:Clone()
    local workplayer = game.Workspace:FindFirstChild(player.Name)
    local tw = game:GetService("TweenService")
    workplayer.HumanoidRootPart.Anchored = true
    beam.Parent = game.Workspace
    BeamRing.Parent = game.Workspace
    BeamRing:MoveTo(workplayer.UpperTorso.Position + (workplayer.HumanoidRootPart.CFrame.lookVector*4.5) - Vector3.new(0,0,0))
    beam.Orientation = workplayer.HumanoidRootPart.Orientation
    beam.Position = workplayer.HumanoidRootPart.Position+(workplayer.HumanoidRootPart.CFrame.lookVector*5)
    BeamRing.Part1.Orientation = workplayer.HumanoidRootPart.Orientation
    BeamRing.Part2.Orientation = workplayer.HumanoidRootPart.Orientation+Vector3.new(0,90)
    BeamRing.Part3.Orientation = workplayer.HumanoidRootPart.Orientation+Vector3.new(0,90)
    BeamRing.Part4.Orientation = workplayer.HumanoidRootPart.Orientation+Vector3.new(0,90)
    BeamRing.Part5.Orientation = workplayer.HumanoidRootPart.Orientation+Vector3.new(0,90)
    beam.Size = Vector3.new(4.023, 3.567, 1)
    local goal = {Size = Vector3.new(4.023, 3.567, 20.391)}
    local goalt = {Transparency = 1}
    local twset = TweenInfo.new(0.2)
    local goal2 = {Orientation = Vector3.new(0,0,360.1) }
    local twset2 = TweenInfo.new(1,0,0,5,true,0)
    tw:Create(beam,twset,goal):Play()
    tw:Create(BeamRing.Part2,twset2,goal2):Play()
    tw:Create(BeamRing.Part3,twset2,goal2):Play()
    tw:Create(BeamRing.Part4,twset2,goal2):Play()
    tw:Create(BeamRing.Part5,twset2,goal2):Play()
    workplayer.Humanoid:LoadAnimation(script.Animation):Play()
    beam.Position = (workplayer.UpperTorso.Position + (workplayer.HumanoidRootPart.CFrame.lookVector*15) - Vector3.new(0,0,0))
    wait(0.8)
    tw:Create(beam,twset,goalt):Play()
    wait(0.2)
    beam:Destroy()
    BeamRing:Destroy()
    workplayer.HumanoidRootPart.Anchored = false
    beam.Touched:Connect(function(hit)
        print(hit.Name)

        end)
end)




Thanks in advance for any help

0
It would be really nice if you could perhaps explain your code a bit. Soban06 410 — 3y
0
It shoots a beam when a key is pressed however the touched event is not working robot7866 36 — 3y
0
It shoots a beam when a key is pressed however the touched event is not working robot7866 36 — 3y

Answer this question