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

How can I make the door teleports the victim towards the player?

Asked by 1 year ago
Edited 1 year ago

Hello!

I made a tool Inside of a NPC, what the tool does Is that when activated summons a door, and what the door does Is that when a victim decides to touch that said door will get teleported to the user, which Is very good to get kills, but the problem Is that even when the victim touches the door, they won't be teleported to the user

Script:

local Tool = script.Parent
local Troll = Tool.Parent
local Debounce = false

Tool.Activated:Connect(function()
    if not Debounce then
        Debounce = true
        local Door = game:GetService("ReplicatedStorage").Stuff.Door:Clone()
        Door.Parent = game.Workspace
        Door.Position = Tool.Parent.Torso.Position
        Door.Orientation = Tool.Parent.Torso.Orientation
        Door.CFrame = Door.CFrame + (Door.CFrame.LookVector*5)
        Door.CanCollide = false
        Door.Anchored = true
        wait(3)
        game:GetService("Debris"):AddItem(Door,12)
        Door.Transparency = 1
        Door.Touched:Connect(function(hit)
            local Humanoid = hit.Parent:WaitForChild("Humanoid")
            if Humanoid ~= Troll then
                hit.CFrame = Tool.Parent.Torso.CFrame
                game:GetService("Debris"):AddItem(Door,0)
            end
        end)
        wait(3)
        Debounce = false
    end
end)

Answer this question