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

Is there other better ways other than using Mouse.TargetSurface?

Asked by
CjayPlyz 643 Moderation Voter
5 years ago
local p = script.Parent.Parent.Parent
local r = script.Parent.RemoteEvent

local function o (p,t,ts)
    local pt = Instance.new("Part")
    pt.Size = Vector3.new(4,4,4)
    if ts == Enum.NormalId.Top then
        pt.Position = t.Position + Vector3.new(0,4,0)
    else
        if ts == Enum.NormalId.Bottom then
            pt.Position = t.Position + Vector3.new(0,-4,0)
        else
            if ts == Enum.NormalId.Front then
                pt.Position = t.Position + Vector3.new(0,0,-4)
            else
                if ts == Enum.NormalId.Back then
                    pt.Position = t.Position + Vector3.new(0,0,4)
                else
                    if ts == Enum.NormalId.Left then
                        pt.Position = t.Position + Vector3.new(-4,0,0)
                    else
                        if ts == Enum.NormalId.Right then
                            pt.Position = t.Position + Vector3.new(4,0,0)
                        end
                    end
                end
            end
        end
    end
    pt.Anchored = true
    pt.Parent = workspace
end

r.OnServerEvent:Connect(o)

I'm using Mouse.TargetSurface to get the right position.

1 answer

Log in to vote
0
Answered by
CjayPlyz 643 Moderation Voter
5 years ago

I just saw an answer, vector3.FromNormalId(). Sorry for the trouble

Ad

Answer this question