Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Thanks for using this script
- Want to know how to use this and script explanation?
- Check the video here: https://youtu.be/oXBi18J--Xo
- ]]
- local center1 = workspace.portalA.Center
- local center2 = workspace.portalB.Center
- local canTouch = true --You can remove this line, you don't need it
- local plr = game.Players.LocalPlayer
- center1.Touched:Connect(function(hit)
- if hit.Parent:FindFirstChild("Humanoid") then
- local char = hit.Parent
- local player = game.Players:GetPlayerFromCharacter(char)
- local touchValue = player:FindFirstChild("canTouch")
- if touchValue.Value == true then
- touchValue.Value = false
- local offset = center1.CFrame:ToObjectSpace(char.HumanoidRootPart.CFrame)
- char.HumanoidRootPart.CFrame = center2.CFrame * offset
- wait(1)
- player.canTouch.Value = true
- end
- end
- end)
- center2.Touched:Connect(function(hit)
- if hit.Parent:FindFirstChild("Humanoid") then
- local char = hit.Parent
- local player = game.Players:GetPlayerFromCharacter(char)
- local touchValue = plr:FindFirstChild("canTouch")
- if touchValue.Value == true then
- touchValue.Value = false
- local offset = center2.CFrame:ToObjectSpace(char.HumanoidRootPart.CFrame)
- char.HumanoidRootPart.CFrame = center1.CFrame * offset
- wait(1)
- player.canTouch.Value = true
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement