Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

How do I make a part that goes from a specific place to me?

Asked by 6 days ago

I'm trying to make a part that starts at a part and end at me the character this is my script for a beam effect but im looking for a cylinder part

    local character = player.Character
    if character.HumanoidRootPart.Position.Y < 100000 then
        local BP = Instance.new("BodyPosition",character.HumanoidRootPart)
        local Attachment1 = Instance.new('Attachment',character.HumanoidRootPart)
        game.Workspace.Construction.OwnersHome.Transmitter.Beam.Attachment1 = Attachment1
        BP.Position = game.Workspace.Construction.OwnersHome.Transmitter.Position+Vector3.new(0,10,0)
        BP.MaxForce = Vector3.new(10000,10000,10000)
        BP.D = 4150
        game.Workspace.Construction.OwnersHome.Platform.CanCollide = false
        game.Workspace.Construction.OwnersHome.Transmitter.CanCollide = false
        game.Workspace.Construction.OwnersHome.Platform.Touched:Connect(function(hit)
            if hit.Name == "RightFoot" or hit.Name == "LeftFoot" then
                BP:Destroy()
                Attachment1:Destroy()
                game.Workspace.Construction.OwnersHome.Platform.CanCollide = true
                game.Workspace.Construction.OwnersHome.Transmitter.CanCollide = true
            end
        end)
    elseif character.HumanoidRootPart.Position.Y >= 100000 and character.HumanoidRootPart.Position.Y <= 100005 then
        local BP = Instance.new("BodyPosition",character.HumanoidRootPart)
        local DP = Instance.new("Part",workspace.Construction)
        local Attachment1 = Instance.new('Attachment',DP)
        character.HumanoidRootPart.Position = game.Workspace.Construction.OwnersHome.Transmitter.Position
        game.Workspace.Construction.OwnersHome.Transmitter.Beam.Attachment1 = Attachment1
        DP.CanCollide = false
        DP.Transparency = 1
        DP.Anchored = true
        DP.Name = "DestinationPart"
        DP.CFrame = Mouse+Vector3.new(0,-100000,0)
        BP.Position = DP.Position
        BP.D = 4175
        BP.MaxForce = Vector3.new(10000,10000,10000)
        game.Workspace.Construction.OwnersHome.Platform.CanCollide = false
        game.Workspace.Construction.OwnersHome.Transmitter.CanCollide = false
        local function feetOntouch(hit)
            if hit.Name == "Terrain" then
                game.Workspace.Construction.OwnersHome.Platform.CanCollide = true
                game.Workspace.Construction.OwnersHome.Transmitter.CanCollide = true
                DP:Destroy()
                BP:Destroy()
            end
        end
        character.LeftFoot.Touched:Connect(feetOntouch)
        character.RightFoot.Touched:Connect(feetOntouch)
    end

1 answer

Log in to vote
0
Answered by 6 days ago

try this

local beam = workspace.Cylinder --name the cylinder Cylinder




script.Parent.Touched:Connect(function(hit)
    local character = hit.Parent
    local humanoid = hit.Parent:FindFirstChild ("Humanoid")


    if humanoid then

        beam.CFrame = CFrame.new(hit.Parent.UpperTorso.Position)--if you are using r6 use Torso and not Upper Torso
        -- you can change UpperTorso to whatever body part you want

        wait(1)
    end

    wait(1)
end)
0
That does not work im trying to make the part on one end its touching me on the other its touching something else Boindoin -5 — 6d
Ad

Answer this question