help i am using this

local Mouse = game.Players.LocalPlayer:GetMouse()
local RunService = game:GetService("RunService")
local db = false
local DB = false
local Switch = false
local NotActivated = true
local P1 = script.Parent:WaitForChild('Portal1').Value
local P2 = script.Parent:WaitForChild('Portal2').Value
local Char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local HRP = Char:WaitForChild('HumanoidRootPart')

RunService.RenderStepped:Connect(function()
	Mouse.Button1Up:Connect(function()
		if not db then
			if not NotActivated then
				local TargetSurface = Mouse.TargetSurface
				if not Switch then
					P1.Parent = game.Workspace
					P1.Position = Mouse.Hit.p
					P1.CFrame = CFrame.new(P1.Position,HRP.Position)
					if TargetSurface == Enum.NormalId.Top then
						P1.Orientation = Vector3.new(90, 180, 0)
					elseif TargetSurface == Enum.NormalId.Front then
						P1.Orientation = Vector3.new(0, 0, 180)
					elseif TargetSurface == Enum.NormalId.Right then
						P1.Orientation = Vector3.new(0, -90, 180)
					elseif TargetSurface == Enum.NormalId.Back then
						P1.Orientation = Vector3.new(0, 180, 180)
					elseif TargetSurface == Enum.NormalId.Left then
						P1.Orientation = Vector3.new(0, 90, 180)
					elseif TargetSurface == Enum.NormalId.Bottom then
						P1.Orientation = Vector3.new(-90, -180, 0)			
					end
					Switch = true
				else
					P2.Parent = game.Workspace
					P2.Position = Mouse.Hit.p
					P2.CFrame = CFrame.new(P2.Position,HRP.Position)
					if TargetSurface == Enum.NormalId.Top then
						P2.Orientation = Vector3.new(90, 180, 0)
					elseif TargetSurface == Enum.NormalId.Front then
						P2.Orientation = Vector3.new(0, 0, 180)
					elseif TargetSurface == Enum.NormalId.Right then
						P2.Orientation = Vector3.new(0, -90, 180)
					elseif TargetSurface == Enum.NormalId.Back then
						P2.Orientation = Vector3.new(0, 180, 180)
					elseif TargetSurface == Enum.NormalId.Left then
						P2.Orientation = Vector3.new(0, 90, 180)
					elseif TargetSurface == Enum.NormalId.Bottom then
						P2.Orientation = Vector3.new(-90, -180, 0)			
					end
					Switch = false
				end
			end
			db = true
			wait()
			db = false
		end
	end)
	P2.Touched:Connect(function(hit)
		if hit.Parent:FindFirstChild('Humanoid') and not DB then
			DB = true
			local HRP = hit.Parent.HumanoidRootPart
			HRP.CFrame = P1.CFrame + Vector3.new(0,6,0)
			HRP.Velocity = P1.CFrame.LookVector * 100 -- I want to calculate the speed of the player multiply it by 2 and throw the player by the speed for example PlayerVelocity = PlayerSpeed * 2
			wait(2)
			DB = false
		end
	end)

	P1.Touched:Connect(function(hit)
		if hit.Parent:FindFirstChild('Humanoid') and not DB then
			DB = true
			local HRP = hit.Parent.HumanoidRootPart
			HRP.CFrame = P2.CFrame + Vector3.new(0,6,0)
			HRP.Velocity = P2.CFrame.LookVector * HRP.Velocity * 100 -- I want to calculate the speed of the player multiply it by 2 and throw the player by the speed for example PlayerVelocity = PlayerSpeed * 2
			wait(2)
			DB = false
		end
	end) 
end)

script.Parent.Equipped:Connect(function()
	NotActivated = false
end)

script.Parent.Equipped:Connect(function()
	NotActivated = true
end)

but no work

2 comments

1

can you update with the full code, so we can get a bit more context :)

0

K