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

How to make part collide with other part?

Asked by 4 years ago
Edited 4 years ago

I would like to make tpindicator collide with other parts so it can show exactly where player will teleport after player lets go of key 'e'.

  • tpindicator is half in the part that mouse.Hit is on
local players = game:GetService("Players")
local player = players.LocalPlayer
local hrp = player.Character.HumanoidRootPart
local mouse = player:GetMouse()
local uis = game:GetService("UserInputService")
local tpindicator = Instance.new("Part", game.Workspace); tpindicator.Name = "teleportindication"; tpindicator.Size = Vector3.new(4, 5, 1); tpindicator.Color = Color3.new(0, 0, 1); tpindicator.Transparency = 1; tpindicator.BrickColor = BrickColor.new("Really blue"); tpindicator.TopSurface = Enum.SurfaceType.SmoothNoOutlines; tpindicator.Anchored = true; tpindicator.CanCollide = false
local rs = game:GetService("RunService")
local connect
--

mouse.KeyDown:connect(function(key)
if key == "e" then
    connect = rs.Heartbeat:connect(function(step)
        tpindicator.Transparency = 0.5
        mouse.TargetFilter = game.workspace.teleportindication
        tpindicator.CFrame = CFrame.new(mouse.Hit.x, mouse.Hit.y, mouse.Hit.z)
        tpindicator.Orientation = hrp.Orientation

    end)
end
end)

mouse.KeyUp:connect(function(key)
if key == "e" then
    if mouse.Target then
        hrp.CFrame = CFrame.new(mouse.Hit.x, mouse.Hit.y + 5, mouse.Hit.z)
        hrp.CFrame = tpindicator.CFrame * CFrame.new(0,3,0)
        tpindicator.Transparency = 1

        connect:disconnect()
    end
end
end)

Please help.

0
Use tpindicator.Position instead fredfishy 833 — 4y
0
@fredfishy, I applied your change on line 16, not sure if this is where you intended for change to take place. Though my same issue still appears Loserboyp -2 — 4y

Answer this question