How to make Portal Gun VPF?

Firstly, you shouldn’t ask for scripts. Try to learn, then, if you can’t understand you can ask. Also there is already a post about this. Check the forum at least once, before you post.

1 Like

Hey But where get this script im no scripter

1 Like

Hi I’d Like To Help You!

First Go To Workspace And Insert Tools Name It PortalGun And Build The Portal Gun If You Done Put The Tools Inside The StarterPack. Then Insert Script Inside The Portal Gun Name It : ServerHandler. then Add This Code :

script.Parent:WaitForChild("MakePortalPart").OnServerEvent:Connect(function(player, cFrame, handle, mouse, portalPart, pos, otherPortalPart)
	game.ReplicatedStorage.SayPortal:FireAllClients()
	local tweenservice = game:GetService("TweenService")
	local portalBall = Instance.new("Part", workspace)
	local weld = Instance.new("WeldConstraint", portalBall)
	portalBall.Shape = "Ball"
	portalBall.CFrame = cFrame
	portalBall.BrickColor = portalPart.TeleporterPart.BrickColor
	portalBall.Material = Enum.Material.Neon
	portalBall.Size = Vector3.new(1, 1, 1)
	local portaltime = 0.1
	local mousePosTween = tweenservice:Create(portalBall, TweenInfo.new(portaltime), {CFrame = CFrame.new(pos.X, pos.Y, pos.Z)})
	mousePosTween:Play()
	wait(portaltime)
	portalBall:Destroy()
	portalPart.TeleporterPart.Position = pos + Vector3.new(0, 3, 0)
	if mouse == nil then
		
	else
		portalPart.TeleporterPart.Orientation = Vector3.new(mouse.Orientation.X, mouse.Orientation.Y, mouse.Orientation.Z)
	
	end
	local t1 = tweenservice:Create(portalPart.TeleporterPart, TweenInfo.new(0.1), {Size = game.ServerScriptService.PortalHolder.ModelBlue.Size})
	local t2 = tweenservice:Create(otherPortalPart.TeleporterPart, TweenInfo.new(0.1), {Size = game.ServerScriptService.PortalHolder.ModelBlue.Size})
	if portalPart.TeleporterPart.Size == game.ServerScriptService.PortalHolder.ModelBlue.Size then
		portalPart.TeleporterPart.Size = Vector3.new(1, 1, 1)
		wait()
		t1:Play()
		if otherPortalPart.TeleporterPart.Size == game.ServerScriptService.PortalHolder.ModelBlue.Size then
			otherPortalPart.TeleporterPart.Size = Vector3.new(1, 1, 1)
			wait()
			t2:Play()
		else
			otherPortalPart.TeleporterPart.Size = Vector3.new(1, 1, 1)
			wait()
			t2:Play()
		end
	else
		t1:Play()
	end
	if mouse == nil then
		weld:Destroy()
	elseif mouse:IsA("Part") then
		weld.Part0 = portalPart.TeleporterPart
		weld.Part1 = mouse
	end
	
end)
script.Parent:WaitForChild("PlaySound").OnServerEvent:Connect(function(player)
	script.Parent.Activated:Connect(function()
		script.Parent.Fire:Play()
	end)
end)

Then Insert Local Script Inside The PortalGun Name It : PortalScript. Then Add This Code :

local Camera = workspace.CurrentCamera
local Handle = script.Parent:WaitForChild("Handle")
local player = game.Players.LocalPlayer
local PortalLoadedIn = "BluePortal"
local BluePortal = workspace:WaitForChild(player.Name.."'s Portals").PortalBlue
local OranagePortal = workspace:WaitForChild(player.Name.."'s Portals").PortalOrange
local mouse = player:GetMouse()
local ani = script.Parent:WaitForChild("holdAnimation")
local currentCamera = workspace.CurrentCamera
local tweenService = game:GetService("TweenService")
local TipObject = script.Parent:WaitForChild("Tip")
local keys = false
local playAni = false
local walking = false
local walkingCF = CFrame.new()
local swayingCF = CFrame.new()
local UserInputService = game:GetService("UserInputService")
local playSound = script.Parent:WaitForChild("PlaySound")
player.CameraMode = Enum.CameraMode.LockFirstPerson

local RunService = game:GetService("RunService")
local run



script.Parent.Equipped:Connect(function()
	local aniHumanoid
	mouse.Icon = "rbxassetid://120192974"
	keys = true
	playAni=true
	local viewmodel = script.Parent.Handle:Clone()
	viewmodel.Parent = Camera
	viewmodel.Transparency = 0
	script.Parent.Handle.Transparency = 1
	run = RunService.RenderStepped:Connect(function()
		swayingCF = swayingCF:Lerp(CFrame.new(math.rad(game:GetService("UserInputService"):GetMouseDelta().X), math.rad(game:GetService("UserInputService"):GetMouseDelta().Y), 0), 0.1)
		if viewmodel then
			viewmodel.CFrame = Camera.CFrame * walkingCF * swayingCF * CFrame.new(1,-1.3,-3) * CFrame.Angles(-1,0,0)
			viewmodel.CanCollide = false
		end
		if walking then
			walkingCF = walkingCF:Lerp(CFrame.new(0.1*math.sin(tick() * 4), 0.1*math.sin(tick() * 6), 0), 0.1)
		else
			walkingCF = walkingCF:Lerp(CFrame.new(),0.1)
		end
		player.Character:WaitForChild("Humanoid").Running:Connect(function(speed)
			if speed > 0 then
				walking = true
			else
				walking = false
			end
		end)
	end)
	script.Parent.Activated:Connect(function()
		playSound:FireServer()
		
		if PortalLoadedIn == "BluePortal" then
			script.Parent:WaitForChild("MakePortalPart"):FireServer(TipObject.CFrame, Handle, mouse.Target, BluePortal, mouse.Hit.p, OranagePortal)
			game.ReplicatedStorage.SayPortal:FireServer(mouse.Hit.p)
			wait(0.09)
			PortalLoadedIn = "OrangePortal"
		end
		
	end)
	script.Parent.Activated:Connect(function()
		if PortalLoadedIn == "OrangePortal" then
			script.Parent:WaitForChild("MakePortalPart"):FireServer(TipObject.CFrame, Handle, mouse.Target, OranagePortal, mouse.Hit.p, BluePortal)
			wait(0.09)
			PortalLoadedIn = "BluePortal"
		end
	end)
	UserInputService.InputBegan:Connect(function(key)
		if key.KeyCode == Enum.KeyCode.H then
			if keys then
				PortalLoadedIn = "OrangePortal"
			end
		end
		if key.KeyCode == Enum.KeyCode.G then
			if keys then
				PortalLoadedIn = "BluePortal"
			end
		end
		
	end)
	while wait() do
		
		if playAni then
			aniHumanoid = player.Character.Humanoid:LoadAnimation(ani)
			aniHumanoid:Play()
		else
			aniHumanoid:Stop()
		end
	end
end)
script.Parent.Unequipped:Connect(function()
	mouse.Icon = ""
	playAni = false
	keys = false
	if run then
		run:Disconnect()
		if Camera:FindFirstChild("Handle") then
			Camera.Handle:Destroy()
		end
	end
end)
game.ReplicatedStorage.SayPortal.OnClientEvent:Connect(function()
	game.StarterGui:SetCore("ChatMakeSystemMessage", {
		Text = "{Server-Side, all players} Message = "..player.Name.." put a portal down! Watch out for his!";
		Color = Color3.fromRGB(82, 203, 214);
		Font = Enum.Font.SourceSans;
		FontSize = Enum.FontSize.Size32;
	})
end)

Then Add Remote Events Inside The PortalGun Name It: MakePortalPart

Ok Now Add Folder Inside ServerScriptService Name It : PortalHolder Then Add Script Inside The Folder Name It : PortalHandler then Add The Part You Want To Teleport Called TeleporterPart. Then Add The Teleporter Part Again Inside The Folder Name It : ModelBlue. Then Add A Script Inside Server Script Service Name It : portalCreate. Then Add This Code :

game.Players.PlayerAdded:Connect(function(player)
	local portalfolder = game.ServerScriptService.PortalHolder:Clone()
	portalfolder.Parent = workspace
	portalfolder.Name = player.Name.."'s Portals"
end)
game.Players.PlayerRemoving:Connect(function(player)
	if workspace:FindFirstChild(player.Name.."'s Portals") then
		workspace:FindFirstChild(player.Name.."'s Portals"):Destroy()
	end
end)

Then Move To Replicated Storage Insert Remote Events Name It : SayPortal.

This Is All My Explain I Hope This Help Full

3 Likes

I’m understand This Localscript?

i Already Said Which Is Local Script Or Script

I’m again understand Where a put Script?

I Already Explain It Please Read Carefully

that a person just turned 13 yrs old so he probaly wont understand as clearly

2 Likes

Please Stay On Topic Replies.
And What Do You Mean This

3 Likes

No work You Can did screenshot?

I’m Sorry No Because I’m On My Phone Now It’s My Time To Bed It’s Already 12.38 Am But i will screenshot you tomorrow!

1 Like

Hey Please You are back today?

Can you just read the post carefully? He already explained where to insert the script.

2 Likes

Ahh im know where also get script in free model no vpf portal

Copy!! This no vpf portal gun!!

What am I reading here 0_o
THis is so hard to understand

Hey there. This post might be of interest to you.

1 Like

https://doy2mn9upadnk.cloudfront.net/uploads/default/original/4X/d/1/1/d118ea5e87c8f14dc2c930c57f5aefb13a7d3486.mp4 I’m watch this guy did VPF Portal gun

How to did this script press a mouse you can make a portal

You always didn’t understand what people explain :blush: