Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Tool = script.Parent
- local Player = Tool.Parent.Parent
- local Character = Player.Character or Player.CharacterAdded:Wait()
- local Debounce,IsOn = {}, false
- local Debounce2 = {}
- if Debounce[Player] then return end
- Tool.Activated:Connect(function()
- if IsOn then return end --true
- local GateEffect = game.ReplicatedStorage.WarpEffect:Clone()
- GateEffect.Parent = game.Workspace
- Debounce[Player] = GateEffect
- IsOn = true
- local WC = Instance.new("WeldConstraint",GateEffect)
- GateEffect.CFrame = Character.HumanoidRootPart.CFrame
- WC.Part0 = GateEffect
- WC.Part1 = Character.HumanoidRootPart
- wait(5)
- if IsOn then IsOn = false Debounce[Player]:Destroy() end
- end)
- Tool.Unequipped:Connect(function()
- IsOn = false
- Debounce[Player]:Destroy()
- end)
- Player.Chatted:Connect(function(msg)
- if not IsOn then return end
- if Debounce2[Player] then return end
- for i,v in pairs(game.Workspace.TeleportLocations:GetChildren()) do
- if msg:lower() == tostring(v.Name:lower()) then
- print(msg)
- local BottomPart = game.ReplicatedStorage.BottomPart:Clone()
- BottomPart.Position = Character.HumanoidRootPart.Position + Vector3.new(0,-3,0)
- Debounce2[Player] = BottomPart
- Character.Humanoid:LoadAnimation(script.SnapGate):Play()
- local CircleTween = game.TweenService:Create(BottomPart, TweenInfo.new(1.2,Enum.EasingStyle.Sine,Enum.EasingDirection.In), {Size = Vector3.new(0.05, 5, 5)})
- BottomPart.Parent = workspace
- CircleTween:Play()
- CircleTween.Completed:Connect(function()
- Character.HumanoidRootPart.Position = v.Position
- IsOn = false
- Debounce[Player]:Destroy()
- BottomPart.Touched:Connect(function(Hit)
- if Hit.Parent and Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent ~= Character then
- Hit.Parent.HumanoidRootPart.Position = v.Position
- end
- end)
- local Reverse = game.TweenService:Create(BottomPart, TweenInfo.new(2,Enum.EasingStyle.Sine,Enum.EasingDirection.In), {Size = Vector3.new(0.05, 0.05, 0.05)})
- Reverse:Play()
- Reverse.Completed:Connect(function()
- Debounce2[Player]:Destroy()
- Debounce2[Player] = nil
- end)
- end)
- end
- end
- end)
- Debounce[Player] = nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement